|
@@ -1,9 +1,9 @@
|
|
|
<template>
|
|
|
<view class="container">
|
|
|
<enterNavigator :selectedIndex="nav_current_index" @clickToIndex='homeNavigatorClick'/>
|
|
|
- <home :viewTop="subviewTop" :viewHeight="subviewHeight" v-if="nav_current_index == config.page_index.home" />
|
|
|
- <AIChat :viewTop="subviewTop" :viewHeight="subviewHeight" v-if="nav_current_index == config.page_index.ai_chat" />
|
|
|
- <AIDraw :viewTop="subviewTop" :viewHeight="subviewHeight" v-if="nav_current_index == config.page_index.ai_draw" />
|
|
|
+ <home :viewTop="subviewTop" :viewHeight="subviewHeight" v-show="nav_current_index == config.page_index.home" />
|
|
|
+ <AIChat :viewTop="subviewTop" :viewHeight="subviewHeight" v-show="nav_current_index == config.page_index.ai_chat" />
|
|
|
+ <AIDraw :viewTop="subviewTop" :viewHeight="subviewHeight" v-show="nav_current_index == config.page_index.ai_draw" />
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -21,11 +21,35 @@
|
|
|
subviewHeight: 0,
|
|
|
}
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+ let systemInfo = uni.getSystemInfoSync()
|
|
|
+
|
|
|
+ this.subviewTop = 60
|
|
|
+ this.subviewHeight = systemInfo.screenHeight - this.subviewTop
|
|
|
+
|
|
|
+ this.onNotification()
|
|
|
+ },
|
|
|
+ onUnload() {
|
|
|
+ this.offNotification()
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ onNotification() {
|
|
|
+ let self = this
|
|
|
+ uni.$on(config.notification.switch_page_index, function(index) {
|
|
|
+ // console.log('notification_index', index)
|
|
|
+ if(self.nav_current_index == index) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ self.nav_current_index = index
|
|
|
+ })
|
|
|
+ },
|
|
|
+ offNotification() {
|
|
|
+ uni.$off(config.notification.switch_page_index)
|
|
|
+ },
|
|
|
homeNavigatorClick(index) {
|
|
|
if(index == config.page_index.ai_chat ||
|
|
|
index == config.page_index.ai_draw) {
|
|
|
- if(this.tools.is_login_gotoLogin() == false) {
|
|
|
+ if(this.tools.is_login_gotoLogin(index) == false) {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
@@ -33,23 +57,6 @@
|
|
|
this.tools.current_navigator_page_index = index
|
|
|
}
|
|
|
},
|
|
|
- mounted() {
|
|
|
- let systemInfo = uni.getSystemInfoSync()
|
|
|
-
|
|
|
- this.subviewTop = 60
|
|
|
- this.subviewHeight = systemInfo.screenHeight - this.subviewTop
|
|
|
-
|
|
|
- let self = this
|
|
|
- uni.$on(config.notification.switch_page_index, function(index) {
|
|
|
- if(self.nav_current_index == index) {
|
|
|
- return
|
|
|
- }
|
|
|
- self.nav_current_index = index
|
|
|
- })
|
|
|
- },
|
|
|
- onUnload() {
|
|
|
- uni.$off(config.notification.switch_page_index)
|
|
|
- },
|
|
|
components: {
|
|
|
enterNavigator,
|
|
|
home,
|
|
@@ -61,6 +68,6 @@
|
|
|
|
|
|
<style lang="scss">
|
|
|
.container{
|
|
|
-
|
|
|
+ background-color: #2A2832;
|
|
|
}
|
|
|
</style>
|