Authored by yyq

report

... ... @@ -149,6 +149,21 @@ router.onReady(() => {
});
}
if (to.query.report_yas) {
let reportParam = to.query.report_param || {};
store.dispatch('reportYas', {
params: {
appop: to.query.report_yas,
param: {
...reportParam,
FP_NAME: from.name,
FP_PARAM: from.params[getReportParamsKey(from.name)],
}
}
});
}
return next();
} catch (e) {
store.dispatch('reportError', {error: e});
... ...
... ... @@ -83,6 +83,8 @@ export default {
if (+this.$route.params.id !== this.id) {
this.id = +this.$route.params.id;
this.init();
} else {
this.reportProductShow(this.articleInfo);
}
},
async serverPrefetch() {
... ... @@ -162,6 +164,8 @@ export default {
}, 500);
}
this.reportProductShow(get(res, 'data.detailList[0]'));
if (this.share && this.setShareData) {
this.setShareData(get(res, 'data.detailList[0]'));
}
... ... @@ -222,6 +226,36 @@ export default {
this.$refs.detailNote && ($detail = this.$refs.detailNote);
$detail.$refs.header && $detail.$refs.header.onBack();
},
reportProductShow(article) {
const productList = article.productList || [];
if (!productList.length) {
return;
}
let name = this.$yoho.isiOS ? 'iFP_ArticleList' : 'aFP_ArticleList';
this.$store.dispatch('reportYas', {
params: {
appop: YAS.eventName.show,
param: {
DATA: [
...productList.map((p, i) => {
return {
P_NAME: name,
P_PARAM: this.id,
I_INDEX: i,
ARTICLE_ID: this.id,
PRD_SKN: p.productSkn,
ATR_TYPE: article.sort == 2 ? 1 : 2,
PRD_TYPE: p.collage_activity_id ? 'collage_info' : ''
};
})
],
}
}
});
}
},
components: {
... ...
... ... @@ -120,6 +120,13 @@ export default {
name: 'article',
params: {
id: this.data.articleId
},
query: {
report_yas: YAS.eventName.detailShow,
report_param: {
ART_ID: this.data.articleId,
ATR_TYPE: this.data.sort === 2 ? 1 : 2
}
}
});
this.reportClickArticle();
... ...
... ... @@ -14,6 +14,7 @@
import ArticleItem from './author-article-item';
import {assign, get, forEach} from 'lodash';
import {getArticleImageSize} from 'utils/image-handler';
import YAS from 'utils/yas-constants';
export default {
data() {
... ... @@ -159,15 +160,20 @@ export default {
}
});
},
toArticle({articleId}) {
let router = {
toArticle({articleId, sort}) {
this.$router.push({
name: 'article',
params: {
id: articleId
},
query: {
report_yas: YAS.eventName.detailShow,
report_param: {
ART_ID: articleId,
ATR_TYPE: sort === 2 ? 1 : 2
}
}
};
this.$router.push(router);
});
}
},
components: {
... ...