123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536 |
- 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)
- }
- }
- })
|