forked from useryangtao/vue-wechat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.vue
119 lines (116 loc) · 3.3 KB
/
app.vue
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
<template>
<div id="app">
<header class="app-header" style="display:none;" v-show="appload">
<div class="_effect" :class="{'_effect--50':decline}">
<index-header style="overflow:visible;"></index-header>
</div>
</header>
<section class="app-content" style="display:none;" v-show="appload">
<!-- index router -->
<router-view keep-alive></router-view>
</section>
<footer class="app-footer _line-fine" style="display:none;" v-show="appload">
<div class="_effect " :class="{'_effect--50':decline}">
<index-nav></index-nav>
</div>
</footer>
<!--mask layer-->
<section class="welcome" v-show="welcome" transition="welcome"></section>
<section class="mobile-tips" style="dislay:none;" v-show="isnotMobile">
<div class="mobile-tips-inner">
<div class="mobile-model"> <img src="./assets/images/mobile.png" alt=""></div>
<p><br>为保证最佳用户体验,<br></p>
<p class="_align-left">1.请用chrome移动设备调试模式(F12)下打开</p>
<p class="_align-left">2.手机浏览器访问</p>
<br>
<button class="weui_btn weui_btn_mini weui_btn_primary" v-touch:tap='isnotMobile = false'>关闭</button>
</div>
</section>
</div>
</template>
<script>
import store from 'store'
import indexHeader from 'components/index-header.vue'
import indexNav from 'components/index-nav.vue'
require('assets/css/common.scss')
require('assets/css/base.scss')
export default {
replace: false,
store,
data() {
return {
appload: false,//主结构
welcome: false,//欢迎页
isnotMobile:false,//是否为移动设备访问
decline: false //router animation
}
},
created() {
let isMobile = function(){
let userAgentInfo = navigator.userAgent;
let Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod")
let flag = false;
for (let v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = true; break; }
};
return flag;
}();
if(!isMobile){
this.isnotMobile = true;
}
if (this.$route.matched.length === 1) {
this.welcome = true;
}
this.appload = true;
setTimeout(() => {
this.welcome = false;
}, 2000)
},
events: {
'route-pipe' (_decline) {
this.decline = _decline
}
},
components: {
indexHeader,
indexNav
}
}
</script>
<style scoped>
.welcome {
width: 100%;
height: 100%;
z-index: 1000;
position: fixed;
left: 0;
top: 0;
transition: .25s all linear;
background: url(./assets/images/launchimage.png) no-repeat center center;
background-size: cover;
}
.welcome-leave {
opacity: 0;
}
.mobile-tips{
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 100;
background-color: rgba(0,0,0,.75);
text-align: center;
color: #cccccc;
display: flex;
justify-content: center;
align-items: center;
}
.mobile-tips-inner{
width: 330px;
padding-bottom: 200px;
}
.mobile-model{
flex-grow: 1;
}
</style>