Authored by 陈峰

blk bug

... ... @@ -57,7 +57,7 @@
uid = uid === 0 ? '' : uid;
window._ozuid = uid; // 暴露ozuid
if (window._yas) {
let ak = 'yohoblk_m';
var ak = 'yohoblk_m';
if (isYohoBuy) {
if (isIos) {
... ...
... ... @@ -20,14 +20,13 @@ export default {
computed: {
...mapState(['yoho'])
},
// watch: {
// ['yoho.visible'](visible) {
// if (visible) {
// this.checkReport();
// }
// }
// },
watch: {
['yoho.pageVisible'](visible) {
if (visible) {
this.checkReport(void 0, true);
}
}
},
mounted() {
this.scrollEvent = throttle(50, this.checkReport);
if (_.get(this.$parent, '$options.name') === 'Scroller') {
... ... @@ -37,7 +36,7 @@ export default {
}
if (this.$scrollEl) {
this.$scrollEl.addEventListener('scroll', this.scrollEvent);
this.checkReport();
this.checkReport(void 0, true);
}
},
destroyed() {
... ... @@ -46,11 +45,11 @@ export default {
}
},
methods: {
checkReport() {
checkReport(evt, isInit) {
_.each(this.$children, (component, index) => {
const visiable = this.isVisiable(component.$el, this.$scrollEl);
if (visiable && this.componentStatus[index] !== visiable) {
if (visiable && (this.componentStatus[index] !== visiable || isInit)) {
this.report(component, index + 1);
}
this.componentStatus[index] = visiable;
... ...
... ... @@ -4,6 +4,7 @@ import {
ROUTE_CHANGE,
PAGE_INIT_VISIBLE,
REPORT_YAS,
YOHO_PAGE_VISIBLE,
} from 'store/yoho/types';
import FastClick from 'fastclick';
import {createApp} from './app';
... ... @@ -40,6 +41,9 @@ document.addEventListener('visibilitychange', function() {
}, 500);
}
});
window.blkPageSwtich = (visible) => {
store.commit(YOHO_PAGE_VISIBLE, {visible});
};
router.onReady(() => {
router.beforeResolve((to, from, next) => {
... ...
... ... @@ -73,7 +73,7 @@
uid = uid === 0 ? '' : uid;
window._ozuid = uid; // 暴露ozuid
if (window._yas) {
let ak = 'yohoblk_m';
var ak = 'yohoblk_m';
if (isYohoBuy) {
if (isIos) {
... ...
... ... @@ -5,6 +5,7 @@ import {
INIT_ROUTE_CHANGE,
PAGE_INIT_VISIBLE,
REPORT_YAS,
YOHO_PAGE_VISIBLE,
} from './types';
import cookie from 'yoho-cookie';
import _ from 'lodash/core';
... ... @@ -22,6 +23,7 @@ export function createYoho() {
fs: true
},
visible: true,
pageVisible: false,
history: [],
direction: 'forword'
},
... ... @@ -59,6 +61,9 @@ export function createYoho() {
},
[PAGE_INIT_VISIBLE](state, {visible}) {
state.visible = visible;
},
[YOHO_PAGE_VISIBLE](state, {visible}) {
state.pageVisible = visible;
}
},
actions: {
... ...
... ... @@ -3,4 +3,5 @@ export const SET_TITLE = 'SET_TITLE';
export const ROUTE_CHANGE = 'ROUTE_CHANGE';
export const INIT_ROUTE_CHANGE = 'INIT_ROUTE_CHANGE';
export const PAGE_INIT_VISIBLE = 'PAGE_INIT_VISIBLE';
export const YOHO_PAGE_VISIBLE = 'YOHO_PAGE_VISIBLE';
export const REPORT_YAS = 'REPORT_YAS';
... ...