znw@123! há 1 mês atrás
pai
commit
91e435561f
2 ficheiros alterados com 16 adições e 14 exclusões
  1. 1 12
      src/views/home/homeSide.vue
  2. 15 2
      src/views/home/index.vue

+ 1 - 12
src/views/home/homeSide.vue

@@ -90,9 +90,7 @@
 <script>
 import {
   getConversations,
-  getConversationsById,
   getConversationsThroughReact,
-  getConversationsByIdThroughReact,
   clearConversation
 } from '@/api/dataChart'
 import { mapGetters } from 'vuex'
@@ -154,16 +152,7 @@ export default {
         return
       }
       this.lastSelected = index
-      this.loading = true
-      try {
-        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)
-      } finally {
-        this.loading = false
-      }
+      this.$emit('update', this.conversationList[index].conversation_id)
     },
 
     handleLogout () {

+ 15 - 2
src/views/home/index.vue

@@ -79,6 +79,10 @@ import InitChart from '@/components/Charts/initChart'
 import { cloneDeep } from 'lodash'
 import HomeSide from './homeSide.vue'
 import FullscreenToggle from '@/components/FullscreenToggle'
+import {
+  getConversationsById,
+  getConversationsByIdThroughReact
+} from '@/api/dataChart'
 export default {
   name: 'HomeIndex',
   components: {
@@ -203,8 +207,17 @@ export default {
       this.chart.setOption(_option, true)
       this.chart.hideLoading()
     },
-    onUpdate (data) {
-      this.$refs.dataChartEditChatRefs.update(data)
+    async onUpdate (conversationId) {
+      this.$refs.dataChartEditChatRefs.loading = true
+      try {
+        const getApi = this.react ? getConversationsByIdThroughReact : getConversationsById
+        const { data } = await getApi(conversationId)
+        this.$refs.dataChartEditChatRefs.update(data)
+      } catch (error) {
+        this.$snackbar.error(error)
+      } finally {
+        this.$refs.dataChartEditChatRefs.loading = false
+      }
     },
     onUpdateConversation () {
       this.$refs.homeSideRefs.getConversationList()