123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <template>
- <view class="container">
- <enterNavigator :selectedIndex="nav_current_index" @clickToIndex='homeNavigatorClick'/>
- <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>
- <script>
- import enterNavigator from '../../pages/enter/enter-navigator.vue'
- import home from '../../pages/home/home.vue'
- import AIChat from '../../pages/AI_chat/AI_chat.vue'
- import AIDraw from '../../pages/AI-draw/AI-draw.vue'
- import config from '../../utils/config.js'
- export default {
- data() {
- return {
- nav_current_index: 0, // 当前导航索引
- subviewTop: 0,
- subviewHeight: 0,
- }
- },
- methods: {
- homeNavigatorClick(index) {
- if(index == config.page_index.ai_chat ||
- index == config.page_index.ai_draw) {
- if(this.tools.is_login_gotoLogin() == false) {
- return
- }
- }
- this.nav_current_index = index
- 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,
- AIChat,
- AIDraw
- }
- }
- </script>
- <style lang="scss">
- .container{
- background-color: #ffffff;
- }
- </style>
|