|
@@ -73,6 +73,7 @@ export default {
|
73
|
73
|
name: 'index',
|
74
|
74
|
data () {
|
75
|
75
|
return {
|
|
76
|
+ ExitAppStatus: false,
|
76
|
77
|
bannerList: [
|
77
|
78
|
{
|
78
|
79
|
image: 'https://niucai.oss-cn-beijing.aliyuncs.com/app/images/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20201101151720.png',
|
|
@@ -101,9 +102,17 @@ export default {
|
101
|
102
|
this.Init()
|
102
|
103
|
},
|
103
|
104
|
mounted () {
|
|
105
|
+ if (window.history && window.history.pushState) {
|
|
106
|
+ this.ExitAppStatus = false
|
|
107
|
+ window.history.pushState(null, null, document.URL)
|
|
108
|
+ window.addEventListener('popstate', this.RouterBack, false)
|
|
109
|
+ }
|
104
|
110
|
this.$nextTick(() => {
|
105
|
111
|
})
|
106
|
112
|
},
|
|
113
|
+ destroyed () {
|
|
114
|
+ window.removeEventListener('popstate', this.RouterBack, false)
|
|
115
|
+ },
|
107
|
116
|
methods: {
|
108
|
117
|
...mapActions([
|
109
|
118
|
'GetAllLotteryType'
|
|
@@ -116,6 +125,14 @@ export default {
|
116
|
125
|
...mapIndexMutations([
|
117
|
126
|
'EmptyBanner'
|
118
|
127
|
]),
|
|
128
|
+ RouterBack () {
|
|
129
|
+ if (this.ExitAppStatus) {
|
|
130
|
+
|
|
131
|
+ } else {
|
|
132
|
+ this.Toast('再按一次退出应用')
|
|
133
|
+ this.ExitAppStatus = true
|
|
134
|
+ }
|
|
135
|
+ },
|
119
|
136
|
Init (done = () => { }) { // 初始化
|
120
|
137
|
this.EmptyBanner()
|
121
|
138
|
this.GetBanner({ queryData: { pageNum: 1, pageSize: 10, status: 1, adType: 'app-index-banner' } }).then(() => { // 获取banner
|