var app = getApp(); //获取应用实例 const util = require('@/static/utils/util.js'); const config = require('@/static/config.js'); import requestConfig from '@/static/lib/requestConfig'; import Bus from '@/common/bus'; export default { data(){ return { repeatFlag: false,//防止重复提交 showShareOptions:false,//是否打开 projectCode: "", //项目地块的id isInMakePhone: false, jumpTempData: null, //跳转页面之前检查是否授权,保存的参数 } }, watch:{ }, methods:{ optionChange(val) { this.showShareOptions = val; //④外层调用组件方注册变更方法,将组件内的数据变更,同步到组件外的数据状态中 }, navigateToCityFromNav(e) { this.navigateToCity(e); }, swipeItemClk(e) { this.navigateFuc(e); }, cityProductComponentClk(e) { this.navigateFuc(e); }, cityListComponentClk(e) { this.navigateFuc(e); }, navigateToZhuangHu(e){ let jumplink = e.currentTarget.dataset.jumplink; //已经认证的地址 let jumpvalue = e.currentTarget.dataset.jumpvalue; if(!jumplink||!jumpvalue){ uni.showToast({ title:'敬请期待', icon:'none', duration:1500 }) }else{ uni.navigateTo({ url:`/onlineHouseHold/pages/chooseRoom/homePage?houseId=${jumpvalue}&activityId=${jumplink}` }) } }, //跳转到城市搜索页面 navigateToCity(e) { uni.navigateTo({ url: '/subPackage/pages/addressModule/addressModule' }); }, resetParentScroll() { this.scrollTop = this.old.scrollTop; this.$nextTick(() => { this.scrollTop = 0; }); }, /** * refresh视图,滚到顶部 */ refreshCityProductView() { this.scrollTop = this.old.scrollTop; this.$nextTick(() => { this.scrollTop = 0; }); }, expandCityProductView(e) { let one = app.globalData.systemInfo.windowWidth / 750; //获取rpx 和 px 的转换比例 console.log("expandCityProductView:" + JSON.stringify(e)); let scrollDistance = e.scrollDistance; scrollDistance += this.scrollDistance2; if (this.navigateHasPadding) { scrollDistance -= app.globalData.navigateStatusContainerHeight; } console.log("expandCityProductView111:" + scrollDistance); if (this.specialPage) { scrollDistance -= 69 * one; scrollDistance -= 6; console.log("expandCityProductView222:" + scrollDistance); } if(this.houseId){//如果是集团页面-原代码是放置在tabview中的-此处判断有扩大范围 let marginTop = e.marginTop.replace('rpx', "") || 0 scrollDistance -= marginTop * one; } this.scrollTop = this.old.scrollTop; this.$nextTick(() => { this.scrollTop = scrollDistance; }); }, expandCityListView(e) { let one = app.globalData.systemInfo.windowWidth / 750; //获取rpx 和 px 的转换比例 console.log("expandCityListView:" + JSON.stringify(e)); let scrollDistance = e.scrollDistance; scrollDistance += this.scrollDistance2; if (this.navigateHasPadding) { scrollDistance -= app.globalData.navigateStatusContainerHeight; } console.log("expandCityProductView111:" + scrollDistance); if (this.specialPage) { scrollDistance -= 69 * one; scrollDistance -= 6; console.log("expandCityProductView222:" + scrollDistance); } if(this.houseId){//如果是集团页面-原代码是放置在tabview中的-此处判断有扩大范围 let marginTop = e.marginTop.replace('rpx', "") || 0 scrollDistance -= marginTop * one; } this.scrollTop = this.old.scrollTop; this.$nextTick(() => { this.scrollTop = scrollDistance; }); }, swipeUnitScrollHandle(e) { console.log("swipeUnitScrollHandle:" + JSON.stringify(e)); if (e.detail.event == 0) { this.scrollAble = false; } else { this.scrollAble = true; } }, //用户信息授权结束后-执行 可根据type 知道是否授权成功 afterUserHandle(e) { console.warn("afterUserHandle", e); var _type = e.detail ? e.detail.type : e.type; let isSuc = _type === 'fail' ? false : true; let currPage = getCurrentPages()[getCurrentPages().length - 1] ? getCurrentPages()[getCurrentPages().length - 1].$vm : null; let para = { type: 'CLK', //埋点类型 clkId: 'clk_2cmina_137', //点击ID,固定 clkName: "wechatauthorize", //点击名称 clkParams: { "userInfo": app.globalData.userInfo || '', "phone": app.globalData.phone || '', "uni.authorize.scope": "uni.getUserInfo", "type": _type, }, }; util.trackRequest(para); if (e) { this.showInfoModel = false; } }, async afterShareOptionHandle(e) { if (this.repeatFlag) { return; } this.repeatFlag = true; var pages = getCurrentPages(); var page = pages[pages.length - 1];//当前页面 var pageInstance = page ? page.$vm : {};//页面实例,可以调用页面实例定义的方法 var currentRoute = page ? page.route : "";//当前页面路径 console.log("afterShareOptionHandle", currentRoute); if (!currentRoute.startsWith('/')) { currentRoute = ('/' + currentRoute); } let path = currentRoute; let subtype = "",houseId='',fromProject='',logo='',gpName='',pageId='',fromBrand=false; // let componentId = app.globalData.componentId || pageInstance.componentId||''; // let componentType = app.globalData.componentType || pageInstance.componentType||''; if(currentRoute.indexOf('/groupIndex')>-1){//集团首页 subtype = 'brand'; houseId = ''; fromProject = app.globalData.brandShare; logo = app.globalData.logo || ''; gpName = app.globalData.projectName || ''; fromBrand = true; } else if(currentRoute.indexOf('/index/index/')>-1){//项目首页 subtype = 'project'; houseId = pageInstance.houseId; fromProject = app.globalData.projectShare; logo = app.globalData.houseProject.logo || ''; gpName = app.globalData.houseProject.projectName || ''; } else if(pageInstance.houseId){//项目层 subtype = 'project'; houseId = pageInstance.houseId; fromProject = app.globalData.projectShare; logo = app.globalData.houseProject.logo || ''; gpName = app.globalData.houseProject.projectName || ''; pageId = pageInstance.pageId || ''; fromBrand = pageInstance.fromBrand || ''; } else{ //集团层 subtype = 'brand'; houseId = ''; fromProject = app.globalData.brandShare; logo = app.globalData.logo || ''; gpName = app.globalData.projectName || ''; pageId = pageInstance.pageId || ''; fromBrand = pageInstance.fromBrand || ''; } let attrs = { shareType: 'qrcode', fromProject: fromProject, pageId: pageId, fromBrand: fromBrand, // componentId:componentId, // componentType:componentType, }; if(path.indexOf('/activityWorking')>-1){//活动页面 attrs.sharerId = pageInstance.currentShareInfo && pageInstance.currentShareInfo.productionOwnerId ? pageInstance.currentShareInfo.productionOwnerId : ''; attrs.productionId = pageInstance.currentShareInfo && pageInstance.currentShareInfo.productionId ? pageInstance.currentShareInfo.productionId : ''; attrs.activityPageId = pageInstance.activityPageId; attrs.activityId = pageInstance.activityId; } else if(path.indexOf('/photoActivity')>-1){//摄影大赛 attrs.sharerId = pageInstance.currentShareInfo && pageInstance.currentShareInfo.productionOwnerId ? pageInstance.currentShareInfo.productionOwnerId : ''; attrs.productionId = pageInstance.currentShareInfo && pageInstance.currentShareInfo.productionId ? pageInstance.currentShareInfo.productionId : ''; attrs.activityId = pageInstance.activityId; if (pageInstance.currentShareInfo && pageInstance.currentShareInfo.productionOwnerId) { path = '/activityPackage/pages/photoCenter/photoCenter' } else { path = '/activityPackage/pages/photoActivity/photoActivity' } } let sign = await app.setShareToken({ subtype: subtype, houseId: houseId, attrs: attrs, }); let obj = { type: 8, path: path, shareToken: sign || app.globalData.shareToken, houseId: houseId, logo: logo, //logo图片 gpName: gpName, //名称 defaultImage: 'https://dm.static.elab-plus.com/miniprogramDemo/projectDemo/demo1.png', }; if(path.indexOf('/activityWarmUp')>-1 || path.indexOf('/activityWorking')>-1 || path.indexOf('/photoActivity')>-1 || path.indexOf('/photoCenter')>-1){//预热页 活动页 摄影大赛 obj.isActivity = 1; obj.defaultImage = pageInstance.activityDataDetail&&pageInstance.activityDataDetail.poster?pageInstance.activityDataDetail.poster:'' } app.globalData.shareCardData = JSON.stringify(obj); uni.navigateTo({ url: '/pages/shareCard/shareCard?houseId=' + houseId, }) setTimeout(() => { this.repeatFlag = false; }, 2000) }, //需要授权的跳转 jumpCheck(e) { this.jumpTempData = e; app.globalData.authComponentData = { componentType:e.currentTarget.dataset.clickid || '', componentId:e.currentTarget.dataset.areacpid || '', componentJumpType:e.currentTarget.dataset.jumptype } this.componentId = e.currentTarget.dataset.areacpid || ''; this.componentType = e.currentTarget.dataset.clickid || ''; this.diyArea = e.currentTarget.dataset.diyarea || ''; if (e.currentTarget.dataset.jumptype == 0 && e.currentTarget.dataset.functype != 4) { return } this.afterAuthCheck() }, afterAuthCheck(isSuc) { console.log(this.jumpTempData, 'afterAuthCheck即将跳转') if (this.jumpTempData) { if (this.jumpTempData.currentTarget.dataset.functype == 4) { this.goChatList(this.jumpTempData); } else if (this.jumpTempData.currentTarget.dataset.jumplink && (this.jumpTempData.currentTarget.dataset.jumplink.indexOf('wxxf.fangzg') > -1 || this.jumpTempData.currentTarget.dataset.jumplink.indexOf('wxxf.niu6666') > -1) && !app.globalData .phone) { uni.showToast({ title: '您未授权号码,无法进入', icon: 'none', duration: 1500, }); } else { this.navigateFuc(this.jumpTempData) } this.jumpTempData = null } }, /** * 跳转方法 */ async navigateFuc(e) { var self = this; console.log("navigateFuc", e); let currPageRoute = getCurrentPages()[getCurrentPages().length - 1] ? getCurrentPages()[getCurrentPages().length -1].route : null; // let currPage = getCurrentPages()[getCurrentPages().length - 1] ? getCurrentPages()[getCurrentPages().length - 1].$vm : null; // if (currPage) { // currPage.componentId = e.currentTarget.dataset.areacpid || ''; // currPage.componentType = e.currentTarget.dataset.clickid || ''; // currPage.diyArea = e.currentTarget.dataset.diyarea || ''; // } // 跳转的时候记录下这个组件的相关信息-需要在跳转完成后清空 app.globalData.componentId = e.currentTarget.dataset.areacpid || ''; app.globalData.componentType = e.currentTarget.dataset.clickid || ''; app.globalData.diyArea = e.currentTarget.dataset.diyarea || ''; //兼容链接跳转中有其他原生页的形式 if (e.currentTarget.dataset.jumptype == 1) { let link = e.currentTarget.dataset.jumplink; if (link && link.startsWith('/')) { e.currentTarget.dataset.jumptype = 13; } } if (e.currentTarget.dataset.jumptype == -2 || e.currentTarget.dataset.jumptype == 14) { //打开本地分享弹窗 this.navigateConcern(e); } else if (e.currentTarget.dataset.jumptype == 0) { //不跳转 return false; } else if (e.currentTarget.dataset.jumptype == 1) { //h5 this.navigateWebView(e); } else if (e.currentTarget.dataset.jumptype == 2) { //图集 this.navigateImgSwip(e); } else if (e.currentTarget.dataset.jumptype == 3) { //户型-必须有houseid this.navigateHouseType(e); } else if (e.currentTarget.dataset.jumptype == 4) { //实时实景 this.navigateMoment(e); } else if (e.currentTarget.dataset.jumptype == 5) { //小程序页面 this.navigateToMiniPage(e); } else if (e.currentTarget.dataset.jumptype == 6) { //项目首页页面 if(currPageRoute.indexOf('pages/index/index')>-1){//项目首页 uni.showToast({ title: '敬请期待', icon: 'none', duration: 1500, }); return false; } else{ //不是项目首页才能跳转 this.navigateToProjectIndexPage(e); } } else if (e.currentTarget.dataset.jumptype == 7) { //敬请期待 this.navigateToWaitToast(e); } else if (e.currentTarget.dataset.jumptype == 8) { //筛选搜索 this.navigateToSearch(); } else if (e.currentTarget.dataset.jumptype == 9) { //资讯列表 this.navigateToNewsList(e); } else if (e.currentTarget.dataset.jumptype == 10) { //条件搜索 this.navigateToSearchForContation(e); } else if (e.currentTarget.dataset.jumptype == 12) { //条件搜索 this.goNewVideo(e); } else if (e.currentTarget.dataset.jumptype == 17) { //条件搜索 this.navigateToQuanMin(e); } else if (e.currentTarget.dataset.jumptype == 14) { //打开分享 this.optionChange(true); } else if (e.currentTarget.dataset.jumptype == 15) { //集团视频看房 this.goVideoChat(e); } else if (e.currentTarget.dataset.jumptype == 16) { //去往项目IM this.goChatList(e); } else if (e.currentTarget.dataset.jumptype == 13) { //其他原生页 this.goOtherOriginPage(e) } else if (e.currentTarget.dataset.jumptype == 18) { //跳转其他小程序 this.goOtherMini(e); } else if (e.currentTarget.dataset.jumptype == 20) { //装户购物车 this.navigateToZhuangHuShopCar(e); } else if (e.currentTarget.dataset.jumptype == 21) { //跳转地图页面 this.goMapPage(e); } else if (e.currentTarget.dataset.jumptype == 22) { //活动页面 this.navigateToSplendActivity(e); } else if (e.currentTarget.dataset.jumptype == 23) { //预热页 this.navigateToPreheatActivity(e); } else if (e.currentTarget.dataset.jumptype == 31) { //购房节 this.navigateToBuyActivity(e); } else if (e.currentTarget.dataset.jumptype == 32) { //摄影大赛 this.navigateToPhotoActivity(e); } else if (e.currentTarget.dataset.jumptype == 33) { //房贷计算器 this.navigateToLoan(e); } else if (e.currentTarget.dataset.jumptype == 34) { this.goVrRoom(e) } else if (e.currentTarget.dataset.jumptype == 35) { app.goToShareFriend(e,this.houseId?1:0); // 0 集团,1 项目 } else if (e.currentTarget.dataset.jumptype == 36) { //预约页面-不出现在集团层 this.goAppointmentPage(e); } else if (e.currentTarget.dataset.jumptype == 70) { //问卷页面 app.navigateToQuestionnaire(e,this.houseId?1:0); // 0 集团,1 项目 } else if (e.currentTarget.dataset.jumptype == 37) {//去往新版搜索结果页 app.navigateToSearchResult(e); //去往新版搜索结果页 } else if (e.currentTarget.dataset.jumptype == 38) {//去往新版搜索结果页 this.navigateToZhuangHu(e); //去往新版搜索结果页 } else if (e.currentTarget.dataset.jumptype == 39) {//开启自动注册 this.autoRegister(e); //自动注册 } }, //跳转集团身份认证页面 async navigateToQuanMin(e) { // #ifndef MP-WEIXIN uni.showToast({ title: '敬请期待', icon: 'none', duration: 1500, }); return false; // #endif //没有认证的地址 let jumplink = e.currentTarget.dataset.jumplink || "extraPackage/pages/panKeBao/record/record"; //已经认证的地址 let jumpvalue = e.currentTarget.dataset.jumpvalue || "extraPackage/pages/panKeBao/shareFriends/shareFriends"; var pages = getCurrentPages(); var page = pages[pages.length - 1];//当前页面 var pageInstance = page ? page.$vm : {};//页面实例,可以调用页面实例定义的方法 let data = {}; let requestUrl = ""; if(pageInstance.houseId){//项目层 data = { customerId: (app.globalData.single && app.globalData.single.id) ? app.globalData.single.id : '', houseId: pageInstance.houseId, mobile: app.globalData.phone, }; requestUrl = "getAuthenticationStatus"; if (jumplink.indexOf('houseId') == -1) { let _next = jumplink.indexOf('?')>-1 ? ('&houseId=' + pageInstance.houseId) : ('?houseId=' + pageInstance.houseId) jumplink = jumplink + _next; } if (jumpvalue.indexOf('houseId') == -1) { let _next = jumpvalue.indexOf('?')>-1 ? ('&houseId=' + pageInstance.houseId) : ('?houseId=' + pageInstance.houseId) jumpvalue = jumpvalue + _next; } } else{//集团层 data = { brandId: config.brandId, mobile: app.globalData.phone, }; requestUrl = "getAuthenticationStatusOnBrand"; } const res = await requestConfig(requestUrl, data); console.log("checkoutRecordStatus:", res); if (res.success && res.single && res.single.verificationStatus == 1) { //已完成身份认证 if (!jumpvalue.startsWith('http')) {//不是一个URL链接,则执行跳转 if (!jumpvalue.startsWith('/')) { jumpvalue = ('/' + jumpvalue); } uni.navigateTo({ url: jumpvalue, }); } else {//否则跳转到一个内嵌页面 uni.navigateTo({ url: '/pages/webView/webView?view=' + encodeURIComponent(jumpvalue), fail: function(res) { console.log(res) }, }); } } else { if (!jumplink.startsWith('http')) { if (!jumplink.startsWith('/')) { jumplink = ('/' + jumplink); } // jumplink += ('&showInformation=true'); uni.navigateTo({ url: jumplink, }); } else { uni.navigateTo({ url: '/pages/webView/webView?view=' + encodeURIComponent(jumplink), fail: function(res) { console.log(res) }, }); } } }, /** * 关注项目或者分享 * type:-1 关注项目 * -2 转发分享 */ navigateConcern(e) { let type = e.currentTarget.dataset.jumptype; if (type == -1) {} else if (type == -2 || type == 14) { this.optionChange(true); } }, // 自动注册 autoRegister(e) { app.checkAuthTotal(5, (res) => { this.showPhoneModel = res.showPhoneModel this.showInfoModel = res.showInfoModel //已经有手机号和身份信息-不触发授权 if (!res.showPhoneModel && !this.showInfoModel) { this.autoRegisterHandle(); } else{//需要确保会触发授权-不然,注册的函数不会在这次授权执行,会带入下一次授权,可能会导致错误 app.globalData.authCallbackList.push(this.autoRegisterHandle); } }) }, /** * 自动注册 * @param e */ async autoRegisterHandle() { // 表示已经有手机号且 if(app.globalData.phone && (app.globalData.isUserInfo || uni.getStorageSync('userInfo'))){ var userInfo = app.globalData.userInfo ? app.globalData.userInfo : uni.getStorageSync('userInfo'); let parameter = { kolName: (userInfo && userInfo.nickName ? userInfo.nickName : "未知用户"), kolSex: '2',//未知性别-自动注册 type: 1,//普通人-自动注册使用普通人 kolMobile: app.globalData.phone, brandId: config.brandId, checkStatus: 0, creator: (userInfo && userInfo.nickName ? userInfo.nickName : "未知用户"), //待确定 houseId: (this.houseId || ''), status: 1, all_income: 0, }; const res = await requestConfig('anchorSave', parameter); if (res.success == true) { uni.showToast({ title: '您已成功注册', icon: 'none', duration: 1500, }) } else { uni.showToast({ title: res.message, icon: 'none', duration: 1500, }) } } }, //拨打电话前置函数 beforeNavigateMakePhone(e) { this.jumpTempData = e; app.checkAuthTotal(2, (res) => { if (res.showPhoneModel) { this.isInMakePhone = true; this.showPhoneModel = true; } else { this.navigateMakePhone() } }) }, /** * 拨打电话 * @param e */ navigateMakePhone() { let e = this.jumpTempData; let phone = e.currentTarget.dataset.phone; this.isInMakePhone = false; uni.makePhoneCall({ phoneNumber: phone }) }, /** * 跳转原生H5 * @param e */ navigateWebView: function(e) { console.log(e.currentTarget.dataset); const title = e.currentTarget.dataset.title || ''; const jumpLink = e.currentTarget.dataset.jumplink; console.log("title" + title); let currPage = getCurrentPages()[getCurrentPages().length - 1] ? getCurrentPages()[getCurrentPages().length - 1].$vm : null; let houseId = this.houseId || app.globalData.houseId || (currPage?currPage.houseId:''); if (jumpLink && jumpLink.length > 0) { app.globalData.currDespage = e.currentTarget.dataset.despage || ""; let type = jumpLink.substring(jumpLink.lastIndexOf('.')).toLocaleLowerCase(); // 如果H5连接的是视频则跳转到全屏播放视频的组件页面中 if (type && type == ".mp4") { let url = '/pages/bearVideo/bearVideo?source=' + jumpLink + '&title=' + title; if (houseId) { url += ('&houseId=' + houseId); } uni.navigateTo({ url: url, fail: function(res) { // fail console.log(res) }, }) } else { let webviewUrl = '/pages/webView/webView?view=' + encodeURIComponent(jumpLink) + '&title=' + title; if (houseId) { webviewUrl += ('&houseId=' + houseId); } else { webviewUrl += ('&brandId=' + config.brandId); } if (app.checkWebviewLink(jumpLink)) { uni.showToast({ title: '敬请期待', icon: 'none', duration: 1500, }) } else { uni.navigateTo({ url: webviewUrl, fail: function(res) { console.log(res) }, }) } } app.makeClkTrackRequest(jumpLink) } }, /** * desc: * 1,处理跳转户型或者户型详情 * 2,选择户型列表或者户型楼栋 * */ async handleHouseType(e) { let link = e.currentTarget.dataset.jumplink; let value = e.currentTarget.dataset.jumpvalue; console.log("handleHouseType 跳转户型", e); if (value) { //房间下标 uni.navigateTo({ url: '/subPackage/pages/groupHouseTypeDetail/groupHouseTypeDetail?houseId=' + this.houseId + '&layoutId=' + value, }); } else if (link) { //楼栋ID const res = await requestConfig('pageListLayoutByBuilding', { "houseId": this.houseId, buildingId: link }); if (res && res.success && res.pageModel.resultSet) { if (res.pageModel.resultSet.length > 0) {//跳转的是户型列表 let houseUrl = '/subPackage/pages/groupHouseType/groupHouseType?houseId=' + this.houseId + '&buildingId=' + link; if (app.globalData.houseProject.shareControl.houseModule == 2) { houseUrl = '/subPackage/pages/groupHouseList/groupHouseList?houseId=' + this.houseId + '&buildingId=' + link; } uni.navigateTo({ url: houseUrl, }); } else { uni.showToast({ title: '敬请期待', icon: 'none', duration: 1500, }) } } else { uni.showToast({ title: '敬请期待', icon: 'none', duration: 1500, }) } } }, //户型-新版逻辑是不需要在路口处校验是否授权的 navigateHouseType: function(e) { app.globalData.pageDesc = this.pvCurPageName ? this.pvCurPageName : (this.navbar ? this.navbar.pageName : ''); if(this.houseId){ this.handleHouseType(e); } else{ uni.showToast({ title: '敬请期待', }) } }, // 此时此刻 async navigateMoment(e) { console.log('此时此刻', e); let _data = {} let currPage = getCurrentPages()[getCurrentPages().length - 1] ? getCurrentPages()[getCurrentPages().length - 1].$vm : null; let houseId = this.houseId || app.globalData.houseId || (currPage?currPage.houseId:''); if (houseId) { _data.houseId = houseId; } else { _data.brandId = config.brandId; } const res = await requestConfig('queryMomentCurrent', _data); //获取此时此刻当前播放内容 if (res && res.success && res.single) { //存在视频则可以执行下一步 let url = ""; if (houseId) { url = '/pages/video/video?houseId=' + houseId; } else { url = '/pages/video/video?brandId=' + config.brandId; } // 个性化需求,运营要求针对这个页面强制改为集团层视频 3591 if(this.pageId == 3601 || this.pageId == '3601' || this.pageId == 3591 || this.pageId == '3591'){ url = url + "&fixBrand=1" } uni.navigateTo({ url: url, }) } else { uni.showToast({ title: '敬请期待', }) } }, /** * 跳转项目首页 * @param e */ navigateToProjectIndexPage(e) { let houseId = e.currentTarget.dataset.jumpvalue; if (houseId && houseId.toString().length > 0) { uni.navigateTo({ url: '/pages/index/index?houseId=' + houseId, fail: function(res) { console.log(res); }, }) } }, //敬请期待 navigateToWaitToast(e) { uni.showToast({ title: '敬请期待' }); }, /** * 跳转搜索 * @param e */ navigateToSearch(type) { // 2021.8.16号产品确定所有集团的跳转都转到新的搜索页面上去 let url = '/subPackage/pages/searchNewModule/searchNewModule'; // if(config.brandId=='46'){//大悦城跳转到新的搜索结果页,其他不变 // url = '/subPackage/pages/searchNewModule/searchNewModule'; // } // if(config.brandId=='6'){//置地-个性化跳转 // url = '/pages/screenSearchListModule/screenSearchListModule'; // if (type) { // url = url + "?openType=" + type; // } // } uni.navigateTo({ url: url, }); }, /** * 条件搜索 * @param e */ navigateToSearchForContation(e) { let url = '/subPackage/pages/searchCondition/searchCondition'; uni.navigateTo({ url: url, }); }, /** * 跳转资讯列表 * @param e */ navigateToNewsList(e) { let _url = "/subPackage/pages/news/newsList/newsList"; let currPage = getCurrentPages()[getCurrentPages().length - 1] ? getCurrentPages()[getCurrentPages().length - 1].$vm : null; let houseId = this.houseId || app.globalData.houseId || (currPage?currPage.houseId:''); if (houseId) { _url = _url + "?houseId=" + houseId; } uni.navigateTo({ url: _url }); }, //打开视频 goNewVideo(e) { let currPage = getCurrentPages()[getCurrentPages().length - 1] ? getCurrentPages()[getCurrentPages().length - 1].$vm : null; const jumpLink = e.currentTarget.dataset.jumplink; const videoId = e.currentTarget.dataset.jumpvalue || ''; const title = e.currentTarget.dataset.expand || ''; let houseId = this.houseId || app.globalData.houseId || (currPage?currPage.houseId:''); let url = '/pages/bearVideo/bearVideo?source=' + jumpLink + '&title=' + title + '&videoId=' + videoId; if (houseId) { url += ('&houseId=' + houseId); } uni.navigateTo({ url: url, }) }, // 集团视频看房 goVideoChat(e) { if (!e.currentTarget.dataset) { uni.showToast({ title: '敬请期待' }); return } let url = "/imRoom/pages/multiroom/aide/aide"; let currPage = getCurrentPages()[getCurrentPages().length - 1] ? getCurrentPages()[getCurrentPages().length - 1].$vm : null; let houseId = this.houseId || app.globalData.houseId || (currPage?currPage.houseId:''); if (houseId) { url += '?houseId=' + houseId; } else { // this.houseId = e.currentTarget.dataset.jumpvalue url += '?houseId=' + e.currentTarget.dataset.jumpvalue; } app.checkAuthTotal(2, (checkRes) => { this.showPhoneModel = checkRes.showPhoneModel; if (!checkRes.showPhoneModel) { // if (!houseId) { // this.houseId = ""; // } uni.navigateTo({ url: url, fail: (res) => { uni.showToast({ duration: 1500, title: '敬请期待' }); }, }) let param = { type: 'CLK', //埋点类型 clkId: 'clk_2cmina_94', //点击ID clkName: 'videoChat-click', //点击前往的页面名称 }; util.trackRequest(param); } }, true); }, // 同屏带看 async goVrRoom(e){ if (!e.currentTarget.dataset) { uni.showToast({ title: '敬请期待' }); return } app.goVrRoom(Number(e.currentTarget.dataset.jumpvalue),Number(e.currentTarget.dataset.jumplink)) }, //去往项目IM async goChatList(e) { let houseId = e.currentTarget.dataset.jumpvalue || this.houseId || app.globalData.houseId; if(!houseId){ uni.showToast({ title: '敬请期待' }); return false; } console.log("***goChatList***",houseId) if (this.showPhoneModel || this.showInfoModel) { return false } // if (this.fromBrand) { // this.houseId = houseId; // } app.checkAuthTotal(2, (checkRes) => { this.showPhoneModel = checkRes.showPhoneModel; if (!checkRes.showPhoneModel) { // if (this.fromBrand) { // this.houseId = ""; // } if (app.handleGoChat(houseId)) { console.log("***goChatList-over***") } } }, true); }, /** * 查询集团项目GUID */ async getProjectGUIDByHouseId() { let requestData = { houseId: this.houseId }; const res = await requestConfig('getProjectGUIDByHouseId', requestData); if (res && res.success && res.single) { this.projectCode = res.single; } }, async goOtherMini(e) { //打开其他小程序 let jumpLink = e.currentTarget.dataset.jumplink; //路径 let appid = e.currentTarget.dataset.jumpvalue || ''; //appid jumpLink = jumpLink.trim(); let projectCodeIdx = jumpLink.indexOf('?projectCode='); if(projectCodeIdx >= 0){ this.projectCode = jumpLink.substring(projectCodeIdx+13,jumpLink.length); jumpLink = jumpLink.substring(0,projectCodeIdx); } let extraData = {}; //只有项目层才会触发该逻辑 if (appid == 'wx38d0e39f4c57c4de' && this.houseId) { if (!this.projectCode) { await this.getProjectGUIDByHouseId(); } if (!app.globalData.phone) {//必须存在手机号才行 // this.forceGetPhoneForMiniJumpData = e; this.showPhoneModel = true;//尝试唤出手机号授权弹窗 // this.forceGetPhoneForMiniJump = true; return } extraData = { projectcode: this.projectCode, //项目code phonenumber: app.globalData.phone, //手机号 consultanttel: '', //置业顾问手机(可为空): consultantname: '', //置业顾问名称(可为空): } console.log("navigate to Other miniprogram", extraData); } uni.navigateToMiniProgram({ appId: appid, path: jumpLink, extraData: extraData, envVersion: 'release', fail(err) { console.warn("***打开其他小程fail***", err) } }) }, ///打开小程序中的原生页面 async goOtherOriginPage(e) { var self = this; let link = e.currentTarget.dataset.jumplink; if (link.startsWith('/')) { link = link.substring(link.indexOf('/') + 1); } link = link.trim(); console.log("goOtherOriginPage-link:" + link); // #ifdef MP-WEIXIN if ((link.indexOf('/scoreCenter') > -1 || link.indexOf('/myCard') > -1 || link.indexOf('/liveRoom') > -1) && !app.globalData.phone) { this.showPhoneModel = true;//尝试唤出手机号授权弹窗 return } // #endif // #ifndef MP-WEIXIN if (link.indexOf("/panKeBao") > -1 || link.indexOf("/defineShare/defineShare") > -1 || link.indexOf("/myCard/myCard") > -1 || link.indexOf('liveRoom') > -1) { uni.showToast({ title: '敬请期待', icon: 'none', duration: 1500, }); return false; } // #endif // 当是主播认证页面,则在这个接口,查询主播是否认证过 // 并且有手机号码,则去查询后台 if (link.includes('extraPackage/pages/hostProve/hostProve') && app.globalData.phone) { let obj = await this.queryAnchorInfo(app.globalData.phone); if (obj.status) { link = obj.url; } } if(this.houseId){//如果存在项目id if(!link.includes('&houseId=')&&!link.includes('?houseId=')){ if (link.indexOf('?') == -1) { link = link + '?houseId=' + self.houseId; } else { link = link + '&houseId=' + self.houseId; } } }else{ if (link.indexOf('?') >= 0) { link += '&fromBrand=true'; } else { link += '?fromBrand=true'; } } uni.navigateTo({ url: '/' + link, fail: (res) => { uni.showToast({ title: '敬请期待', icon: 'none', duration: 1500, }); }, }) }, /** * 跳转到其他原生页 * @param e */ navigateToMiniPage(e) { var self = this; let link = e.currentTarget.dataset.jumplink; let pageId = e.currentTarget.dataset.jumpvalue; let currPage = getCurrentPages()[getCurrentPages().length - 1] ? getCurrentPages()[getCurrentPages().length - 1].$vm : null; let houseId = this.houseId || app.globalData.houseId || (currPage?currPage.houseId:''); if (link.startsWith('/')) { link = link.substring(link.indexOf('/') + 1); } link = link.trim(); console.log("navigateToMiniPage-link:" + link); if(!link){ uni.showToast({ title: '敬请期待' }); return false; } //跳转集团首页 if (link.indexOf("groupIndex1") >= 0 || link.indexOf("groupIndex2") >= 0 || link.indexOf("groupIndex3") >= 0 || link.indexOf("groupIndex4") >= 0) { uni.switchTab({ url: "/" + link, }) } else { let url = '/' + link + '?pageId=' + pageId; if (!houseId) { url += '&fromBrand=true'; } else { url += ('&houseId=' + houseId); } uni.navigateTo({ url: url, fail: (res) => { uni.showToast({ title: '敬请期待' }); } }) } }, //跳转图集-新版逻辑是不需要在路口处校验是否授权的 navigateImgSwip(e) { var self = this; let type = e.currentTarget.dataset.jumpvalue; if(!type){//没有跳转的图集类型,数据不合法 uni.showToast({ title: '敬请期待', }); return false; } let _url = '/subPackage/pages/groupScaleImg/groupScaleImg?type=' + type if(this.houseId){ _url = _url + '&houseId=' + this.houseId; } else{ _url = _url + '&brandId=' + config.brandId; } uni.navigateTo({ url: _url, }); }, //房贷计算器 navigateToLoan(e) { let path = "/subPackage/pages/calculator/calculatorSwitch/calculatorSwitch"; if (this.houseId) { path += ('?houseId=' + this.houseId); } uni.navigateTo({ url: path }) }, //活动页面 navigateToSplendActivity(e) { //不存在pageid if(!e.currentTarget.dataset.jumpvalue){ uni.showToast({ title: '敬请期待', }); return false; } let path = "/activityPackage/pages/activityWorking/activityWorking"; let value = JSON.parse(e.currentTarget.dataset.jumpvalue); let pageId = value.pageId; path += '?activityPageId=' + e.currentTarget.dataset.jumplink + '&pageId=' + pageId if (this.houseId) { path += ('&houseId=' + this.houseId); } else{ path += '&fromBrand=true'; } uni.navigateTo({ url: path }) }, //预热页 navigateToPreheatActivity(e) { //不存在pageid if(!e.currentTarget.dataset.jumpvalue){ uni.showToast({ title: '敬请期待', }); return false; } let url = '/activityPackage/pages/activityWarmUp/activityWarmUp?pageId=' + e.currentTarget.dataset.jumpvalue; if (this.houseId) { url += ('&houseId=' + this.houseId); } else{ url += '&fromBrand=true'; } uni.navigateTo({ url: url }) }, //摄影大赛 navigateToPhotoActivity(e) { //不存在pageid if(!e.currentTarget.dataset.jumpvalue){ uni.showToast({ title: '敬请期待', }); return false; } let path = "/activityPackage/pages/photoActivity/photoActivity?pageId=" + e.currentTarget.dataset.jumpvalue; if (this.houseId) { path += ('&houseId=' + this.houseId); } else{ path += '&fromBrand=true'; } uni.navigateTo({ url: path }) }, //购房节 navigateToBuyActivity(e) { //不存在pageid if(!e.currentTarget.dataset.jumplink){ uni.showToast({ title: '敬请期待', }); return false; } let path = "/activityPackage/pages/activityCommonPages/activityCommonPages"; let houseId = e.currentTarget.dataset.jumpvalue; if (houseId) { path += ('?pageId=' + e.currentTarget.dataset.jumplink + '&houseId=' + houseId) } else { path += ('?pageId=' + e.currentTarget.dataset.jumplink + '&fromBrand=true') } uni.navigateTo({ url: path }) }, //跳转地图页面 goMapPage(e){ if(!this.houseId){ uni.showToast({ title: '敬请期待', icon: 'none', duration: 1500, }) return } let url = config.host + '/index.html#/pages/zongMap/map?houseId=' + this.houseId; uni.navigateTo({ url: '/pages/webView/webView?view=' + encodeURIComponent(url) + '&title=地段配套' + '&houseId=' + this.houseId, fail: function(res) { console.log(res) }, }) }, // 去往预约页面 goAppointmentPage(e){ let pageId = e.currentTarget.dataset.jumpvalue; let houseId = this.houseId||'' if(!pageId){ uni.showToast({ title: '敬请期待', icon: 'none', duration: 1500, }); return } let path = '/activityPackage/pages/appointment/appointment?houseId=' + houseId + '&pageId='+pageId; if (!this.houseId) { path += '&fromBrand=true' } uni.navigateTo({ url: path, fail: (res) => { uni.showToast({ title: '敬请期待' }); }, }) }, /** * 跳转装户购物车 * @param e */ navigateToZhuangHuShopCar(e) { //跳转装户购物车 uni.navigateTo({ url: '/onlineHouseHold/pages/roomShoppingCart/roomShoppingCart', }) }, // 查询主播信息 async queryAnchorInfo(mobile) { uni.showLoading({ title: '加载中' }); const res = await requestConfig('anchorInfo', { mobile, brandId: config.brandId, }); uni.hideLoading(); if (res.success && res.single && res.single.checkStatus !==2) { // 正在审核中 return { url: `extraPackage/pages/results/results?type=${res.single.checkStatus}`, status: true } } else { return { status: false }; } }, } }