app.vue
2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<template>
<div id="app" :style="{height: windowHeight }">
<keep-alive :max="20">
<router-view :key="routerViewKey"></router-view>
</keep-alive>
</div>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
export default {
name: 'App',
data() {
return {
windowHeight: '100%',
};
},
computed: {
...mapState(['yoho']),
routerViewKey() {
if (this.$route.meta && this.$route.meta.routerViewKey) {
return this.$route.meta.routerViewKey;
} else {
return this.$route.fullPath;
}
}
},
mounted() {
if (this.yoho.context.needLogin) {
this.$yoho.auth();
}
// this.$xianyu.setXianyuWebview();
this.$xianyu.setXianyuNav();
this.$sdk.getUser().then(user => {
if (user && user.uid) {
this.SET_LOGIN_INFO(user);
} else {
// queryString中携带bind_code,则弹出绑定弹框
if (this.$route.query.bind_code) {
this.$root.$createThirdBind().open();
}
}
});
this.getZkConfig();
if (typeof window !== 'undefined') {
if (window.screen.availHeight - window.innerHeight > 100) {
this.windowHeight = (window.screen.availHeight - 88) + 'px';
} else {
this.windowHeight = window.innerHeight + 'px';
}
} else {
this.windowHeight = '100%';
}
},
watch: {
'yoho.context.needLogin': function(newVal) {
if (newVal) {
this.$yoho.auth({ needLogin: newVal });
}
}
},
methods: {
...mapMutations(['SET_LOGIN_INFO']),
...mapActions(['getZkConfig'])
}
};
</script>
<style lang="scss">
.route-view-forword-enter-active,
.route-view-forword-leave-active,
.route-view-back-enter-active,
.route-view-back-leave-active {
will-change: transform;
width: 100%;
height: 100%;
position: absolute;
backface-visibility: hidden;
perspective: 1000;
}
.route-view-forword-leave-active,
.route-view-back-leave-active {
transition: all 300ms ease;
}
.route-view-forword-enter-active,
.route-view-back-enter-active {
transition: all 300ms cubic-bezier(0.165, 0.84, 0.44, 1);
}
.route-view-forword-enter {
transform: translate3d(100%, 0, 0);
}
.route-view-forword-enter-active {
z-index: 2;
}
.route-view-forword-leave-active {
z-index: -1;
transform: translate3d(-30%, 0, 0);
}
.route-view-back-enter {
transform: translate3d(-30%, 0, 0);
}
.route-view-back-enter-active {
z-index: -1;
}
.route-view-back-leave-active {
transform: translate3d(100%, 0, 0);
z-index: 2;
}
.cube-safe-area-pb {
border-top-left-radius: 25px;
border-top-right-radius: 25px;
}
</style>