|
@@ -9,11 +9,19 @@
|
|
|
<div class="bm-main-box" style="flex-direction: row">
|
|
|
<div class="flex w-104 flex-col p-4">
|
|
|
<div class="flex border-b border-gray-300 pb-4">
|
|
|
- <img src="@/assets/images/app/app-default-logo.png" class="size-15" />
|
|
|
+ <template v-if="state.detail.icon">
|
|
|
+ <img :src="state.detail.icon" class="size-15" />
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <img
|
|
|
+ src="@/assets/images/app/app-default-logo.png"
|
|
|
+ class="size-15"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
<div class="ml-2 flex flex-1 flex-col justify-around">
|
|
|
<div class="flex justify-between">
|
|
|
<div class="text-xl font-bold text-[#303133]" v-title>
|
|
|
- 应用名称
|
|
|
+ {{ state.detail.name }}
|
|
|
</div>
|
|
|
<el-tooltip
|
|
|
:content="false ? '取消收藏' : '收藏'"
|
|
@@ -34,6 +42,11 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div
|
|
|
+ class="__hover mt-4 flex h-10.5 w-full items-center justify-center gap-2 rounded-lg bg-[#EAF1FF] text-[var(--czr-main-color)]"
|
|
|
+ >
|
|
|
+ <SvgIcon name="msg" :active="true" />开启新对话
|
|
|
+ </div>
|
|
|
<div class="__czr-title_2 mt-4">
|
|
|
记录
|
|
|
<div
|
|
@@ -68,18 +81,25 @@
|
|
|
</div>
|
|
|
<div
|
|
|
class="m-1 flex-1 rounded-lg border-1 border-[var(--czr-main-color)]/5 shadow"
|
|
|
+ v-loading="state.chat.loading"
|
|
|
>
|
|
|
- <chat :online="state.isOnline" :ID="state.ID" />
|
|
|
+ <chat :online="state.chat.isOnline" :ID="state.ID" ref="ref_chat" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { onMounted, reactive } from 'vue'
|
|
|
+import { nextTick, onMounted, reactive, ref } from 'vue'
|
|
|
import toBackCom from '@/views/manage/components/to-back.vue'
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
import chat from '@/views/chat/index.vue'
|
|
|
+import {
|
|
|
+ appConversations,
|
|
|
+ appConversationsSearch,
|
|
|
+ appHistory,
|
|
|
+} from '@/api/modules/app/chat'
|
|
|
+import { appDetail } from '@/api/modules/app'
|
|
|
|
|
|
const router = useRouter()
|
|
|
const route = useRoute()
|
|
@@ -88,8 +108,12 @@ const state: any = reactive({
|
|
|
ID: route.params.id,
|
|
|
detail: {},
|
|
|
history: [],
|
|
|
- isOnline: true,
|
|
|
+ chat: {
|
|
|
+ isOnline: false,
|
|
|
+ loading: false,
|
|
|
+ },
|
|
|
})
|
|
|
+const ref_chat = ref()
|
|
|
const initHistory = () => {
|
|
|
const arr = []
|
|
|
for (let i = 0; i < 20; i++) {
|
|
@@ -97,7 +121,13 @@ const initHistory = () => {
|
|
|
name: '水水水水水水水水水水水水水水水水水水水水水水水水水水水水水',
|
|
|
})
|
|
|
}
|
|
|
- state.history = arr
|
|
|
+ appConversationsSearch({
|
|
|
+ appId: state.ID,
|
|
|
+ page: 1,
|
|
|
+ size: 100000,
|
|
|
+ }).then(({ data }: any) => {
|
|
|
+ state.history = data.records
|
|
|
+ })
|
|
|
}
|
|
|
onMounted(() => {
|
|
|
initDictionary()
|
|
@@ -105,16 +135,25 @@ onMounted(() => {
|
|
|
})
|
|
|
const initDetail = () => {
|
|
|
if (state.ID) {
|
|
|
- state.detail = {}
|
|
|
- // pluginDetail(state.ID)
|
|
|
- // .then(({ data }: any) => {
|
|
|
- // state.detail = data
|
|
|
- // })
|
|
|
- // .catch(() => {})
|
|
|
- // .finally(() => {})
|
|
|
- initHistory()
|
|
|
+ state.chat.loading = true
|
|
|
+ appDetail(state.ID)
|
|
|
+ .then(({ data }: any) => {
|
|
|
+ console.log(2222)
|
|
|
+ state.detail = data
|
|
|
+ document.title = state.detail.name
|
|
|
+ state.chat.isOnline = state.detail.userInputMethod == 1
|
|
|
+ state.chat.loading = false
|
|
|
+ nextTick(() => {
|
|
|
+ ref_chat.value?.init()
|
|
|
+ })
|
|
|
+ initHistory()
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ console.log(3333)
|
|
|
+ // router.push({ name: '4806d051-e037-4d9d-99a0-78aa2f2f362b' })
|
|
|
+ })
|
|
|
} else {
|
|
|
- router.push({ name: 'd446bfb3-4605-477f-a0f4-b7a0a1aa78fe' })
|
|
|
+ router.push({ name: '4806d051-e037-4d9d-99a0-78aa2f2f362b' })
|
|
|
}
|
|
|
}
|
|
|
const initDictionary = () => {
|