Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohoblk-wap
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
陈峰
7 years ago
Commit
2b941f9c3ed85a62aa309a37ebfb3fafd88e61ab
1 parent
094107d2
yas
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
12 deletions
src/components/resources/resource-box.vue
src/index.html
src/store/yoho/index.js
src/components/resources/resource-box.vue
View file @
2b941f9
...
...
@@ -7,6 +7,7 @@
<script>
import {REPORT_YAS} from 'store/yoho/types';
import _ from 'lodash';
import {mapState} from 'vuex';
import {throttle} from 'common/utils';
export default {
...
...
@@ -16,8 +17,19 @@ export default {
componentStatus: {}
};
},
computed: {
...mapState(['yoho'])
},
// watch: {
// ['yoho.visible'](visible) {
// if (visible) {
// this.checkReport();
// }
// }
// },
mounted() {
this.scrollEvent = throttle(50, this.
resourceScroll
);
this.scrollEvent = throttle(50, this.
checkReport
);
if (_.get(this.$parent, '$options.name') === 'Scroller') {
this.$scrollEl = this.$parent.$el;
} else {
...
...
@@ -25,14 +37,7 @@ export default {
}
if (this.$scrollEl) {
this.$scrollEl.addEventListener('scroll', this.scrollEvent);
_.each(this.$children, (component, index) => {
const visiable = this.isVisiable(component.$el, this.$scrollEl);
this.componentStatus[index] = visiable;
if (visiable) {
this.report(component, index + 1);
}
});
this.checkReport();
}
},
destroyed() {
...
...
@@ -41,7 +46,7 @@ export default {
}
},
methods: {
resourceScroll
() {
checkReport
() {
_.each(this.$children, (component, index) => {
const visiable = this.isVisiable(component.$el, this.$scrollEl);
...
...
src/index.html
View file @
2b941f9
...
...
@@ -14,7 +14,6 @@
</script>
</head>
<body>
<!--vue-ssr-outlet-->
<script>
(
function
(
w
,
d
,
s
,
j
,
f
)
{
var
a
=
d
.
createElement
(
s
);
...
...
@@ -96,5 +95,6 @@
})();
</script>
<!--vue-ssr-outlet-->
</body>
</html>
\ No newline at end of file
...
...
src/store/yoho/index.js
View file @
2b941f9
...
...
@@ -6,6 +6,7 @@ import {
PAGE_INIT_VISIBLE
,
REPORT_YAS
,
}
from
'./types'
;
import
cookie
from
'yoho-cookie'
;
import
_
from
'lodash/core'
;
export
function
createYoho
()
{
...
...
@@ -61,8 +62,18 @@ export function createYoho() {
}
},
actions
:
{
[
REPORT_YAS
](
action
,
{
params
:
{
appop
,
param
},
asyncindx
=
false
})
{
[
REPORT_YAS
](
{
state
}
,
{
params
:
{
appop
,
param
},
asyncindx
=
false
})
{
if
(
window
.
_yas
&&
window
.
_yas
.
sendAppLogs
)
{
param
=
param
||
{};
if
(
!
param
.
C_ID
)
{
const
channel
=
{
men
:
1
,
women
:
2
}[
cookie
.
get
(
'_Channel'
)
||
'men'
];
param
.
C_ID
=
channel
;
}
window
.
_yas
.
sendAppLogs
({
appop
,
param
:
param
?
JSON
.
stringify
(
param
)
:
'{}'
...
...
Please
register
or
login
to post a comment