...
|
...
|
@@ -8,7 +8,7 @@ import {Style, Toast, Dialog, ActionSheet} from 'cube-ui'; //eslint-disable-line |
|
|
import Prompt from 'plugins/grass-prompt';
|
|
|
import bus from 'plugins/bus';
|
|
|
|
|
|
import {get} from 'lodash';
|
|
|
import {get, find} from 'lodash';
|
|
|
import Lazy from 'vue-lazyload';
|
|
|
import yoho from 'common/yoho';
|
|
|
import sdk from 'common/sdk';
|
...
|
...
|
@@ -53,6 +53,25 @@ Vue.use(Lazy, {error: ''}); |
|
|
|
|
|
initClient(store);
|
|
|
|
|
|
const getReportParamsKey = (name) => {
|
|
|
let key;
|
|
|
|
|
|
switch (name) {
|
|
|
case 'article.comment':
|
|
|
key = 'articleId';
|
|
|
break;
|
|
|
case 'topic':
|
|
|
case 'topic.share':
|
|
|
key = 'topicId';
|
|
|
break;
|
|
|
default:
|
|
|
key = 'id';
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
return key;
|
|
|
};
|
|
|
|
|
|
const trackPage = (path) => {
|
|
|
if (window._hmt) {
|
|
|
try {
|
...
|
...
|
@@ -77,12 +96,59 @@ router.onReady(() => { |
|
|
params: {
|
|
|
appop: 'YB_H5_PAGE_OPEN_L',
|
|
|
param: {
|
|
|
PAGE_URL: `${location.origin}${to.fullPath}`,
|
|
|
PAGE_NAME: to.name
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
store.dispatch('reportYas', {
|
|
|
params: {
|
|
|
appop: 'YB_H5_PAGE_FLR_C',
|
|
|
param: {
|
|
|
F_URL: `${location.origin}${from.fullPath}`,
|
|
|
PAGE_URL: `${location.origin}${to.fullPath}`,
|
|
|
PAGE_NAME: to.name
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
store.dispatch('reportYas', {
|
|
|
params: {
|
|
|
appop: 'YB_PAGE_ENTER',
|
|
|
param: {
|
|
|
PAGE_ID: to.name,
|
|
|
TYPE_ID: to.params[getReportParamsKey(to.name)],
|
|
|
SOURCE_ID: from.name,
|
|
|
PAGE_NEW_CREATE: !!find(get(store, 'state.yoho.historys'), history => {
|
|
|
return history.path === to.path;
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
store.dispatch('reportYas', {
|
|
|
params: {
|
|
|
appop: 'YB_PAGE_EXIT',
|
|
|
param: {
|
|
|
PAGE_ID: from.name,
|
|
|
TYPE_ID: from.params[getReportParamsKey(from.name)]
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
if (get(store, 'state.yoho.direction') === 'back') {
|
|
|
store.dispatch('reportYas', {
|
|
|
params: {
|
|
|
appop: 'YB_PAGE_FINISH',
|
|
|
param: {
|
|
|
PAGE_ID: from.name,
|
|
|
TYPE_ID: from.params[getReportParamsKey(from.name)]
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
return next();
|
|
|
} catch (e) {
|
|
|
store.dispatch('reportError', {error: e});
|
...
|
...
|
|