123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594 |
- // pages/other/other.js
- var app = getApp();
- const utils = require("../../utils/http");
- const util = require("../../utils/util");
- var time = 0;
- var timer = null;
- let title='',imgurl='';
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- webUrl: '',
- clientype: app.globalData.clientype,
- type:'1',//1是小红屋,2是酷家乐,3是建额全景,剩下的是其他
- companyobj:{},
- personobj:{},
- canIUseGetUserProfile:false,
- loginFlag:false,
- vrType: '',
- aid: '',
- imgUrl: app.globalData.imgUrl,
- platform:'windows'
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- time = 0;
- if (wx.getUserProfile) {
- this.setData({
- canIUseGetUserProfile: true
- })
- }
- if(options.type=='vr'){
- app.globalData.clientype=options.ctp;
- app.globalData.shareuserid = options.uid;
- this.login();
- }
- if (!!options.aid) {
- this.setData({
- aid: options.aid
- })
- }
- if (!!options.cty) {
- this.setData({
- vrType: options.cty
- })
- }
- if (options.type == '21' || options.type == '23') {//新客户
- this.setData({
- webUrl: app.globalData.webUrl + 'applet.html#/customerMsg?token=' + app.globalData.token + '&cid=' + options.vid + '&client_type=' + app.globalData.clientype+"&platform="+app.globalData.platform,
- })
- } else if (options.type == '22') {//共有客户
- this.setData({
- 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,
- })
- } else if (options.type == '3') {//共有客户
- this.setData({
- 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,
- })
- } else if (options.type == '2') {
- this.setData({
- webUrl: options.content,
- clientype: app.globalData.clientype,
- })
- } else if (options.type == '4') {
- // 日报详情
- this.setData({
- 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,
- })
- }
- else if (options.type == '88') {
- this.setData({
- 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
- })
- } else if (options.type == '11') {
- this.setData({
- webUrl: app.globalData.webUrl + 'applet.html#/trainmsg?token=' + app.globalData.token + '&tid=' + options.tid + '&client_type=' + app.globalData.clientype
- })
- } else if (options.type == '48') {//共有客户
- wx.setNavigationBarColor({
- frontColor: '#ffffff',
- backgroundColor: '#2376FF',
- })
- this.setData({
- 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,
- })
- } else if (options.type == '32') {
- this.setData({
- webUrl: app.globalData.webUrl + 'applet.html#/trainCamp?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id
- })
- } else if (options.type == '77') {
- this.setData({
- 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,
- })
- wx.setNavigationBarColor({
- backgroundColor: '#249efb',
- frontColor: '#ffffff',
- })
- } else if (options.type == '29') {
- this.setData({
- 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,
- })
- } else if (options.type == '63') {
- this.setData({
- webUrl: app.globalData.webUrl + 'applet.html#/winPrize?token=' + app.globalData.token + '&actid=' + options.actid + '&client_type=' + app.globalData.clientype,
- })
- } else if (options.type == '9') {
- this.setData({
- webUrl: app.globalData.webUrl + 'applet.html#/designerlist?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype,
- })
- } else if (options.type == '111') {
- // vr
- this.setData({
- webUrl: app.globalData.vraddress,
- })
- } else if (options.type == '121') {
- this.setData({
- 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,
- })
- } else if (options.type == 'vr') {
- // vr
- wx.hideHomeButton()
- let str = unescape(options.vrurl);
- this.setData({
- webUrl: str,
- })
- } else if (options.type == '818') {
- this.setData({
- webUrl: app.globalData.webUrl + 'applet.html#/fiveDimensions?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype + '&empid=' + options.empid,
- })
- } else if (options.type == '919') {
- this.setData({
- 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,
- })
- } else if (options.type == 'screen') {
- wx.setNavigationBarColor({
- backgroundColor: '#C40909',
- frontColor: '#ffffff',
- })
- this.setData({
- webUrl: app.globalData.webUrl + 'applet.html#/wbmanage?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id,
- })
- } else if (options.type == "565") {
- // vr
- wx.hideHomeButton()
- let vrlink = decodeURIComponent(options.vrlink)
- this.setData({
- webUrl: vrlink,
- })
- } else if (options.type == '999') {
- wx.setNavigationBarColor({
- frontColor: '#ffffff',
- backgroundColor: '#191c23',
- })
- this.setData({
- 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,
- })
- } else if (options.type == '525') {
- this.setData({
- webUrl: app.globalData.webUrl + 'applet.html#/addReport?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype,
- })
- } else if (options.type == '656') {
- wx.setNavigationBarColor({
- frontColor: '#ffffff',
- backgroundColor: '#249efb',
- })
- this.setData({
- webUrl: app.globalData.webUrl + 'applet.html#/brokerModule?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id,
- })
- } else if (options.type == '2277') {
- wx.setNavigationBarColor({
- frontColor: '#ffffff',
- backgroundColor: '#249efb',
- })
- this.setData({
- webUrl: app.globalData.webUrl + 'applet.html#/integral?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype + '&brokerId=' + app.globalData.brokeruserId,
- })
- } else if (options.type == '5566') {
- wx.setNavigationBarColor({
- frontColor: '#ffffff',
- backgroundColor: '#249efb',
- })
- this.setData({
- 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,
- })
- } else if (options.type == '13') {
- wx.setNavigationBarColor({
- frontColor: '#ffffff',
- backgroundColor: '#249efb',
- })
- this.setData({
- webUrl: app.globalData.webUrl + 'applet.html#/sharestatistics?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype,
- })
- } else if (options.type == '987') {
- this.setData({
- webUrl: app.globalData.webUrl + 'applet.html#/buildinglist?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype +"&platform="+app.globalData.platform,
- })
- } else if (options.type == '090') {
- this.setData({
- webUrl: app.globalData.webUrl + 'applet.html#/publicQr?token=' + app.globalData.token + '&client_type=' + app.globalData.clientype +"&platform="+app.globalData.platform,
- })
- }else if (options.type == '-87') {//未到访
- wx.setNavigationBarColor({
- frontColor: '#ffffff',
- backgroundColor: '#249efb',
- })
- this.setData({
- 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,
- })
- }
- this.setype();
- },
- sharecompany: function () {
- const that = this;
- utils.$post({
- url: app.globalData.webUrl + 'client/index/content_belong_company',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- client_type: app.globalData.clientype,
- uid: app.globalData.shareuserid
- },
- success: function (res) {
- if (res.data.code == '0') {
- app.globalData.currentUserId = res.data.data.employee_id || '';
- app.globalData.companyobj=res.data.data;
- that.setData({
- companyobj: res.data.data
- })
- that.geTitle();
- }
- },
- complete(res) {
- wx.hideLoading()
- }
- })
- },
- login: function () {
- var that = this;
- wx.login({
- success: function (data) {
- if (data.errMsg == 'login:ok') {
- utils.$post({
- url: app.globalData.webUrl + 'api/users/code2session',
- data: {
- code: data.code,
- share: app.globalData.shareuserid,
- client_type:app.globalData.clientype
- },
- success: function (r) {
- if (r.data.code == '0') {
- app.globalData.sharepersonobj = r.data.share;
- app.globalData.companyobj = r.data.company_data;
- that.setData({
- companyobj: r.data.company_data,
- personobj:r.data.share
- })
- that.sharecompany();
- that.vrFooterRecord();
- if (r.data.user != null&&(!!r.data.user.headimgurl&&r.data.user.headimgurl!=""||!!r.data.user.nickname&&r.data.user.nickname!=""&&r.data.user.nickname!='游客')) {
- that.setData({
- loginFlag: false,
- })
- app.globalData.personMsg = r.data.user;
- app.globalData.userflag = false; //有个人信息
- wx.hideLoading();
- }
- }
- }
- })
- }
- }
- })
- },
- /**
- * vr获取足迹
- */
- vrFooterRecord() {
- var that = this;
- utils.$post({
- url: app.globalData.webUrl + 'client/material/vrfootprints',
- data: {
- type: that.data.vrType,
- id: that.data.aid
- },
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- success: function (r) {
- console.log(r,'<<<<<dsf')
- if(r.data.code=='0'){
- }
- }
- })
- },
- setype(){
- let webUrl=this.data.webUrl;
- let redurltest='https://hnweizhihui.xiaohongwu.com';
- let kjlurltest="https://pano337.p.kujiale.com";
- let jeajurltest="https://vr-17.justeasy.cn";
- let jeajurltest1="https://vr.justeasy.cn";
- if(webUrl.substr(0, 34)==redurltest){
- this.setData({
- type:1,
- platform:app.globalData.platform,
- })
- this.geTitle();
- }
- if(webUrl.substr(0, 29)==kjlurltest){
- this.setData({
- type:2,
- platform:app.globalData.platform,
- })
- this.geTitle();
- }
- if(webUrl.substr(0, 25)==jeajurltest||webUrl.substr(0, 22)==jeajurltest1){
- this.setData({
- type:3,
- platform:app.globalData.platform,
- })
- this.geTitle();
- }
- if (webUrl.substr(0, 29)!=kjlurltest && webUrl.substr(0, 34)!=redurltest&& webUrl.substr(0, 25)!=jeajurltest&&webUrl.substr(0, 22)!=jeajurltest1) {
- this.setData({
- type:'',
- platform:''
- })
- wx.hideShareMenu({
- menus: ['shareAppMessage', 'shareTimeline']
- })
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- callphonetap(){
- wx.makePhoneCall({
- phoneNumber: this.data.personobj.phone
- })
- },
- toPageNameCard() {
- wx.navigateTo({
- 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',
- })
- },
- prelookimgtap() {
- let personobj=this.data.personobj;
- let qrcode='';
- if(!!personobj.qrcode){
- qrcode=personobj.qrcode;
- }else if(!!personobj.binded.qrcode){
- qrcode=personobj.binded.qrcode;
- }
- if (!qrcode) {
- wx.showToast({
- title: "当前装修顾问的二维码为空!",
- icon: 'none',
- duration: 2000
- })
- return false;
- }
- wx.previewImage({
- current: app.globalData.imgUrl + qrcode, // 当前显示图片的http链接
- urls: [app.globalData.imgUrl + qrcode]// 需要预览的图片http链接列表
- })
- },
- getPhoneNumberTap:function(res){
- var that=this;
- if(res.detail.errMsg=='getPhoneNumber:ok'){
- utils.$post({
- url: app.globalData.webUrl + 'api/users/setUserMobile',
- data: {
- encryptedData:res.detail.encryptedData,
- iv:res.detail.iv
- },
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- success: function (r) {
-
- if(r.data.code=='0'){
-
- that.signup(r.data.mobile);
- }else{
- that.setData({
- errorText:r.data.msg,
- errorflag:true
- })
- }
- }
- })
- }
-
- },
- signup:function(mobile){
- const that=this;
- utils.$post({
- url: app.globalData.webUrl + 'client/index/signUp',
- data: {
- name:'',
- remark:'',
- mobile:mobile,
- type:that.data.vrType+'Vr',
- id: that.data.aid,
- },
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- success: function (r) {
- if(r.data.code=='0'){
- wx.showToast({
- title: '恭喜您报名成功',
- icon:'none'
- })
- }
- }
- })
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- timer = setInterval(function () {
- time = (time * 1) + 1;
- }, 1000)
- if(JSON.stringify(app.globalData.sharepersonobj) != "{}"&&!!app.globalData.sharepersonobj){
- this.setData({
- personobj:app.globalData.sharepersonobj
- })
- }else if(JSON.stringify(app.globalData.personMsg) != "{}"){
- var obj=app.globalData.personMsg;
- obj.name=app.globalData.personMsg.binded.name;
- this.setData({
- personobj:obj
- })
- }
- this.setData({
- companyobj:app.globalData.companyobj,
- imgUrl: app.globalData.imgUrl,
- })
-
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- if (timer) {
- clearInterval(timer);
- }
- if (!!this.data.aid) {
- this.visitimefun();
- }
- },
- visitimefun() {
- const that = this;
- utils.$post({
- url: app.globalData.webUrl + 'client/index/visit_due_time',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- id: that.data.aid,
- pipe_type: that.data.vrType+'Vr',
- time: time,
- },
- success: function (res) {
- console.log(res,'<<<<<');
- }
- })
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- if (!!this.data.aid) {
- this.visitimefun();
- }
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- geTitle(){
- if(this.data.vrType=='company'){
- title="在线逛展厅-"+app.globalData.companyobj.company_name;
- imgurl=app.globalData.imgUrl + 'xcx/aaa/vrcover.png';
- }else if(this.data.vrType=='employeeCard'){
- title=app.globalData.companyobj.company_name+'VR寻址';
- imgurl=app.globalData.imgUrl+"/xcx/sharenamecard.png";
- }else if(this.data.vrType=='materialCase'){
- utils.$get({
- url: app.globalData.webUrl + 'client/casedetail',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- id: this.data.aid,
- share:'146'
- },
- success: function (res) {
- if (res.data.code == '0') {
- title=res.data.data.title+'的VR';
- imgurl=res.data.data.cover_img;
- }
- }
- })
- }else if(this.data.vrType=='building'){
- utils.$get({
- url: app.globalData.webUrl + 'client/building/view',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- id: this.data.aid,
- share:'146'
- },
- success: function (res) {
- if (res.data.code == '0') {
- title=res.data.data.name+'的VR';
- imgurl=res.data.data.cover;
- }
- }
- })
- }else if(this.data.vrType=='construction'){
- utils.$post({
- url: app.globalData.webUrl + 'client/construction/view',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- id: this.data.aid,
- share:'146'
- },
- success: function (res) {
- if (res.data.code == '0') {
- title=res.data.data.name+'的VR';
- imgurl=res.data.data.cover;
- }
- }
- })
- }
- },
- addsharetap: function (type) {
- let that = this;
- utils.$post({
- url: app.globalData.webUrl + 'api/share/addlog',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- id: '0',
- type: type,
- },
- success: function (r) {}
- })
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- this.addsharetap('toolAll');
- let str = escape(this.data.webUrl);
- return {
- title: title,
- imageUrl:imgurl,
- 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
- };
- }
- })
|