var IframeOnClick = { resolution: 200, iframes: [], interval: null, Iframe: function() { this.element = arguments[0]; this.cb = arguments[1]; this.hasTracked = false; }, track: function(element, cb) { this.iframes.push(new this.Iframe(element, cb)); var _this = this; this.interval = setInterval(function() { _this.checkClick(); }, this.resolution); }, checkClick: function() { if (document.activeElement) { var activeElement = document.activeElement; for (var i in this.iframes) { if (activeElement === this.iframes[i].element) { // user is in this Iframe if (this.iframes[i].hasTracked == false) { this.iframes[i].cb.apply(window, []); this.iframes[i].hasTracked = true; $.ajax({ type: 'POST', url: '/publicapply/adLeague/click', data: { client: 'WX', id: 'ad6', position: '订阅推送列表页' }, success: function(res) { console.log(res) } }) } } else { this.iframes[i].hasTracked = false; } } } } }; var vm = new Vue({ el: '#select-meau', components: { dateComponent: dateComponent, areaCityMobile: areaCityMobileComponent, industryComponent: industryComponent, cateComponent: cateComponent, keywordComponent: keywordComponent, noticeComponent: noticeComponent, rootComponent: rootComponent }, data () { return { sessStorageKey: '$data-historypush', // 时间参数 time:'', // 选择的时间数据 selectDate: { startDate: '', endDate: '', exact: '' }, // 地区参数 area: '', // 城市 city: '', // 行业参数 subscopeclass: '', // 采购单位 buyerclass: '', // 关键词 key: '', // 公告类型 subtype: '', screenShow: false, tagText: { timeText: '时间', areaText: '地区', industryText: '行业', cateText: '采购单位', keywordText: '关键词', noticeText: '公告类型' }, selectCateList: [], // 选择的采购单位类型列表 selectAreaList: {}, // 选择的地区列表 selectIndustryList: [], // 选择的行业列表 selectKeyWordList: [], // 选择的关键词列表 selectNoticeList: [], // 选择的公告类型列表 setTimer: { datetimer: '', areatimer: '', catetimer: '', industrytimer: '', keytimer: '', noticetimer: '' }, moreFiltersText: { cateItem: '', keywordItem: '', noticeItem: '' }, moreFiltersTextCache: { cateItem: '', keywordItem: '', noticeItem: '' }, moreFiltersShow: { cateItem: false, // 采购单位类型 keywordItem: false, // 关键词 noticeItem: false, // 公告类型 }, iosMeauStyle: false, goUpText: '' } }, computed: { selectedMoreCancelDisabled: function () { return !(this.buyerclass || this.key || this.subtype) } }, created () { this.getHasWeekMonthData() this.getUserRoot() if (firstTime) { firstTime = `${firstTime}_${firstTime}` this.time = firstTime this.setPushTime(firstTime) } else { firstTime = this.time } }, mounted () { var recover = this.recover() if (!recover) { setTimeout(() => { // 如果订阅消息进来时间不为空 if(this.time !== '') { this.setPushTime(this.time) this.revorceOtherData() }else{ // 清空筛选数据 this.revorceData() } }) } // utils.iosBackRefresh() }, methods: { showDialog: function (conf) { var defaultConf = { title: '提示', message: 'message', className: 'j-confirm-dialog', overlayClass: 'j-overlay', showConfirmButton: true, showCancelButton: true, confirmButtonText: '确定', confirmButtonColor: '#2abed1' } if (conf) { Object.assign(defaultConf, conf) } return this.$dialog.confirm(defaultConf) }, // 显示去开通超级订阅弹框 showSuperVipDialog: function () { this.showDialog({ title: '开通超级订阅', message: '立享更多搜索权限\n寻找商机更精准', confirmButtonText: '去开通', className: 'j-confirm-dialog text-center super-vip-dialog', }).then(function () { topay() }).catch(function() {}) }, recover: function () { var excludeKey = ['sessStorageKey', 'moreFiltersShow'] var $data = sessionStorage.getItem(this.sessStorageKey) if ($data) { $data = JSON.parse($data) for (var key in $data) { if (excludeKey.indexOf(key) !== -1) { continue } this.$data[key] = $data[key] } const res = $data // 时间 console.log(res) if(res.time != '') { this.selectDate.startDate = res.time.split('_')[0] * 1000 this.selectDate.endDate= res.time.split('_')[1] * 1000 } // 地区 if(res.area || res.city) { setTimeout(() => { this.$refs.areaCitySelector.setState(this.selectAreaList) $('.areaText').html(res.tagText.areaText) }, 0) } // 采购单位类型 if(res.buyerclass != '') { this.selectCateList = res.buyerclass.split(',') this.moreFiltersText.cateItem = this.selectCateList.length } // 行业 if(res.subscopeclass != '') { setTimeout(() => { $('.industryText').html(res.tagText.industryText) }) this.selectIndustryList = res.subscopeclass.split(',') } // 关键词 if(res.key != '') { this.selectKeyWordList = res.key.split(',') this.moreFiltersText.keywordItem = this.selectKeyWordList.length } // 公告类型 if(res.subtype != '') { this.selectNoticeList = res.subtype.split(',') this.moreFiltersText.noticeItem = this.selectNoticeList.length } sessionStorage.removeItem(this.sessStorageKey) } return !!$data }, // 清空筛选数据 revorceData: function() { this.time = '' this.area = '' this.city = '' this.subtype = '' this.subscopeclass = '' this.key = '' this.buyerclass = '' }, revorceOtherData: function() { this.area = '' this.city = '' this.subtype = '' this.subscopeclass = '' this.key = '' this.buyerclass = '' }, open: function(name) { this.goUpText = name }, close: function() { this.iosMeauStyle = false }, calcSelected: function (which) { return this.moreFiltersText[which] || '全部' }, moreFiltersItemShow: function (which, text) { this.goUpText = text if (this.screenShow) { this.moreFiltersShow[which] = true } else { this.showSuperVipDialog() } }, // 订阅推送消息展示数据 setPushTime: function(time) { let pushtime = { start: parseInt(time.split('_')[0] * 1000), end: parseInt(time.split('_')[0] * 1000), } this.tagText.timeText = new Date(pushtime.end).pattern('yyyy.MM.dd') this.selectDate.startDate = pushtime.start this.selectDate.endDate= pushtime.end this.selectDate.exact = 'exact' }, // 判断是否显示免费用户体验报告入口 checkShowFreeLink () { if (window.isFreeUserStatus && window.isUserWeekMonthStatus) { $(".vip_report").show(); } }, // 判断是否有周报月报数据 getHasWeekMonthData: function () { var _this = this $.ajax({ url: '/subscribepay/report/starttime?type=free', type: 'POST', success: function(res) { // 如果是商机管理、大会员、超级订阅会员有筛选权限 if (res != 0) { window.isUserWeekMonthStatus = true _this.checkShowFreeLink() } } }) }, // 判断是否是有筛选条件 getUserRoot: function() { var _this = this $.ajax({ url: '/publicapply/bidcoll/power', type: 'POST', success: function(res) { // res.data.entniche = false // res.data.member = false // res.data.vip = 0 // 如果是商机管理、大会员、超级订阅会员有筛选权限 if (!res.data.member && res.data.vip <= 0) { window.isFreeUserStatus = true _this.checkShowFreeLink() } if(res.data.entniche || res.data.member || res.data.vip > 0) { _this.screenShow = true } else { _this.screenShow = false; (window.slotbydup = window.slotbydup || []).push({ id: "u6603902", container: "_36y1d8lbx9n", async: true }); (window.slotbydup = window.slotbydup || []).push({ id: "u6603902", container: "_061vbh43quq3", async: true }); _this.getAjaxAdv() setTimeout(() => { var frames = document.getElementById("iframeu6603902_0"); console.log(frames, 'frames') IframeOnClick.track(frames, function() { jQuery(document).click(); }); }, 1000) } } }) }, getAjaxAdv () { $.ajax({ type: 'POST', url: '/publicapply/adLeague/exposure', data: { client: 'WX', id: 'ad6', position: '订阅推送列表页' }, success: function(res) { console.log(res) } }) }, selectedMoreConfirmed: function () { this.$refs.moreDropdownItems.toggle(false) if (this.screenShow) { this.buyerclass = this.moreFiltersTextCache.cateItem this.key = this.moreFiltersTextCache.keywordItem this.subtype = this.moreFiltersTextCache.noticeItem this.doSearch() } }, selectedMoreCancel: function () { this.cancel({ name: 'cateItem' }) this.cancel({ name: 'keywordItem' }) this.cancel({ name: 'noticeItem' }) this.$refs.moreDropdownItems.toggle(false) if (this.screenShow) { this.buyerclass = '' this.key = '' this.subtype = '' this.doSearch() } }, confirm: function(data){ if(data.name === 'dateItem'){ const timeRange = { start: (data.data.start / 1000).toFixed(0), end: (data.data.end / 1000).toFixed(0) } if (timeRange.start == 0 && timeRange.end == 0) { this.time = '' this.tagText.timeText = '时间' } else if(timeRange.start == 0 && timeRange.end != 0) { this.time = '_' + timeRange.end } else if(timeRange.start != 0 && timeRange.end == 0) { this.time = timeRange.start + '_' } else { this.time = timeRange.start + '_' + timeRange.end } this.selectDate.exact = data.data.exact switch (data.data.exact) { case 'all': { this.tagText.timeText = '时间' break } case 'lately7': { this.tagText.timeText = '最近7天' break } case 'lately30': { this.tagText.timeText = '最近30天' break } case 'lastYear': { this.tagText.timeText = '去年' break } case 'exact': { this.tagText.timeText = new Date(timeRange.end*1000).pattern('yyyy.MM.dd') break } } this.setToggle() this.doSearch() } else if(data.name === 'areaCityItem'){ var areaCityRes = data.data var count = data.count this.selectAreaList = areaCityRes if (!areaCityRes || Object.keys(areaCityRes).length === 0) { this.area = '' this.city = '' $('.areaText').html('地区') } else { var obj = { p: [], // 省份全选 c: [] // 所有的市 } for (var key in areaCityRes) { if (areaCityRes[key].length === 0) { obj.p.push(key) } else { obj.c = obj.c.concat(areaCityRes[key]) } } $('.areaText').text('地区 ' + count) this.tagText.areaText = '地区 ' + count this.area = obj.p.join(',') this.city = obj.c.join(',') } this.setToggle() this.doSearch() } else if(data.name === 'industryItem'){ $('.industryText').html(data.t) this.tagText.industryText = data.t this.subscopeclass = data.data.join(',') this.setToggle() this.doSearch() } else if(data.name === 'cateItem'){ this.moreFiltersText.cateItem = data.t this.moreFiltersTextCache.cateItem = data.data.join(',') this.moreFiltersShow.cateItem = false } else if(data.name === 'keywordItem'){ this.moreFiltersText.keywordItem = data.t.replace('关键词', '') this.moreFiltersTextCache.keywordItem = data.data.join(',') this.moreFiltersShow.keywordItem = false } else if(data.name === 'noticeItem'){ this.moreFiltersText.noticeItem = data.t.replace('公告类型', '') this.moreFiltersTextCache.noticeItem = data.data.join(',') this.moreFiltersShow.noticeItem = false } else if(data.name === 'rootItem'){ try { _hmt.push(['_trackEvent','超级订阅-wx', 'click', '推送列表页' + this.goUpText + '-去开通']); } catch (e) { console.log('未初始化百度统计') } topay() } else { return console.log('暂无数据') } }, cancel: function(data){ if(data.name === 'dateItem'){ this.time = '' this.tagText.timeText = '时间' this.selectDate.start = '' this.selectDate.end = '' this.selectDate.exact = 'all' this.setTimer.datetimer = new Date().getTime() this.setToggle() this.doSearch() } else if(data.name === 'areaCityItem'){ this.area = '' this.city = '' $('.areaText').html('地区') this.setTimer.areatimer = new Date().getTime() this.setToggle() this.doSearch() } else if(data.name === 'industryItem'){ this.subscopeclass = '' $('.industryText').html('行业') this.setTimer.industrytimer = new Date().getTime() this.setToggle() this.doSearch() } else if(data.name === 'cateItem'){ this.selectCateList = [] this.moreFiltersTextCache.cateItem = '' this.moreFiltersText.cateItem = '' this.setTimer.catetimer = new Date().getTime() this.moreFiltersShow.cateItem = false } else if(data.name === 'keywordItem'){ this.selectKeyWordList = [] this.moreFiltersTextCache.keywordItem = '' this.moreFiltersText.keywordItem = '' this.setTimer.keytimer = new Date().getTime() this.moreFiltersShow.keywordItem = false } else if(data.name === 'noticeItem'){ this.selectNoticeList = [] this.moreFiltersTextCache.noticeItem = '' this.moreFiltersText.noticeItem = '' this.setTimer.noticetimer = new Date().getTime() this.moreFiltersShow.noticeItem = false } else if(data.name === 'rootItem') { this.setToggle() } }, doSearch: function (delay) { delay = delay || 500 setTimeout(this.getAjaXParams, delay) }, getAjaXParams: function() { ajaxFun(this.time, this.area, this.city, this.subscopeclass, this.buyerclass, this.key, this.subtype) }, setToggle: function() { this.$refs.dateItem.toggle(false) this.$refs.areaCityItem.toggle(false) this.$refs.industryItem.toggle(false) this.$refs.moreDropdownItems.toggle(false) } } })