|
@@ -1,19 +1,18 @@
|
|
|
<template>
|
|
|
<v-navigation-drawer
|
|
|
class="grey lighten-4 navigation"
|
|
|
- dark
|
|
|
+ :dark="!react"
|
|
|
permanent
|
|
|
>
|
|
|
<template v-slot:prepend>
|
|
|
- <v-list-item light>
|
|
|
+ <v-list-item :light="!react">
|
|
|
<v-list-item-content>
|
|
|
- <v-list-item-title class="text-h6">AI取数</v-list-item-title>
|
|
|
+ <v-list-item-title class="text-h6">AI取数 <small class="indigo--text">{{ react ? '(REACT模式)' : '' }}</small></v-list-item-title>
|
|
|
<!-- <v-list-item-subtitle>Logged In</v-list-item-subtitle> -->
|
|
|
</v-list-item-content>
|
|
|
</v-list-item>
|
|
|
<slot name="header"></slot>
|
|
|
</template>
|
|
|
- <v-divider light></v-divider>
|
|
|
<!-- <v-card elevation="0" style="background-color: unset;" :loading="loading"> -->
|
|
|
<div class="text-center" v-if="loading">
|
|
|
<v-progress-circular
|
|
@@ -21,7 +20,7 @@
|
|
|
color="primary"
|
|
|
></v-progress-circular>
|
|
|
</div>
|
|
|
- <v-list dense light>
|
|
|
+ <v-list dense :light="!react">
|
|
|
<v-list-item-group
|
|
|
v-model="selected"
|
|
|
color="primary"
|
|
@@ -41,19 +40,26 @@
|
|
|
|
|
|
<template v-slot:append>
|
|
|
<div class="pa-2">
|
|
|
- <!-- <v-btn class="mb-3" color="indigo" block outlined @click="$router.push('/knowledge-base')">
|
|
|
- 产品知识库
|
|
|
- </v-btn>
|
|
|
- <v-btn class="mb-3" color="indigo" block outlined @click="$router.push('/data-assets')">
|
|
|
- 数据资产
|
|
|
- </v-btn>
|
|
|
- <v-btn class="mb-3" color="indigo" block outlined @click="$router.push('/my-chart')">
|
|
|
+ <div class="d-flex justify-space-around text-center mb-3">
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in fabItems"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <v-btn fab :color="item.color" x-small depressed @click="$router.push(item.to)">
|
|
|
+ <v-icon>{{ item.icon }}</v-icon>
|
|
|
+ </v-btn>
|
|
|
+ <div class="text-caption" :class="item.textColor">
|
|
|
+ {{ item.text }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <v-btn class="mb-3" color="indigo" block @click="$router.push('/my-chart')">
|
|
|
我的图表
|
|
|
</v-btn>
|
|
|
- <v-btn class="mb-3" color="indigo" block outlined @click="$router.push('/team-chart')">
|
|
|
- 团队共享
|
|
|
- </v-btn> -->
|
|
|
- <v-btn block @click="handleLogout">
|
|
|
+ <v-btn class="mb-3" block color="indigo" @click="handleReact">
|
|
|
+ 切换{{ react ? 'ASK模式' : 'REACT模式' }}
|
|
|
+ </v-btn>
|
|
|
+ <v-btn block color="indigo" @click="handleLogout">
|
|
|
Logout
|
|
|
</v-btn>
|
|
|
</div>
|
|
@@ -64,17 +70,34 @@
|
|
|
<script>
|
|
|
import {
|
|
|
getConversations,
|
|
|
- getConversationsById
|
|
|
+ getConversationsById,
|
|
|
+ getConversationsThroughReact,
|
|
|
+ getConversationsByIdThroughReact
|
|
|
} from '@/api/dataChart'
|
|
|
+import { mapGetters } from 'vuex'
|
|
|
export default {
|
|
|
name: 'homeSide',
|
|
|
+ inject: {
|
|
|
+ react: {
|
|
|
+ default: false
|
|
|
+ }
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
+ loading: false,
|
|
|
selected: null,
|
|
|
lastSelected: null,
|
|
|
- conversationList: []
|
|
|
+ conversationList: [],
|
|
|
+ fabItems: [
|
|
|
+ { icon: 'mdi-database', text: '产品知识库', color: 'indigo', textColor: 'indigo--text', to: '/knowledge-base' },
|
|
|
+ { icon: 'mdi-assistant', text: '数据资产', color: 'indigo', textColor: 'indigo--text', to: '/data-assets' },
|
|
|
+ { icon: 'mdi-account-multiple-check-outline', text: '团队共享', color: 'indigo', textColor: 'indigo--text', to: '/team-chart' }
|
|
|
+ ]
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(['userInfo'])
|
|
|
+ },
|
|
|
created () {
|
|
|
this.getConversationList()
|
|
|
},
|
|
@@ -82,7 +105,8 @@ export default {
|
|
|
async getConversationList () {
|
|
|
this.loading = true
|
|
|
try {
|
|
|
- const { data } = await getConversations({ limit: 5 })
|
|
|
+ const subApi = this.react ? getConversationsThroughReact : getConversations
|
|
|
+ const { data } = await subApi(this.userInfo.id, { limit: 5 })
|
|
|
this.conversationList = data.conversations
|
|
|
this.selected = null
|
|
|
} catch (error) {
|
|
@@ -92,7 +116,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
async onSelectConversation (index) {
|
|
|
- if (!index && typeof index !== 'number') {
|
|
|
+ if (index === null) {
|
|
|
setTimeout(() => {
|
|
|
this.selected = this.lastSelected
|
|
|
})
|
|
@@ -100,7 +124,8 @@ export default {
|
|
|
}
|
|
|
this.lastSelected = index
|
|
|
try {
|
|
|
- const { data } = await getConversationsById(this.conversationList[index].conversation_id)
|
|
|
+ const getApi = this.react ? getConversationsByIdThroughReact : getConversationsById
|
|
|
+ const { data } = await getApi(this.conversationList[index].conversation_id)
|
|
|
this.$emit('update', data)
|
|
|
} catch (error) {
|
|
|
this.$snackbar.error(error)
|
|
@@ -109,6 +134,15 @@ export default {
|
|
|
|
|
|
handleLogout () {
|
|
|
this.$store.dispatch('user/userLogout')
|
|
|
+ },
|
|
|
+ handleReact () {
|
|
|
+ if (this.react) {
|
|
|
+ // this.$router.push('/home')
|
|
|
+ window.open('/home', '_blank')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ window.open('/react', '_blank')
|
|
|
+ // this.$router.push('/react')
|
|
|
}
|
|
|
}
|
|
|
}
|