定位完成

This commit is contained in:
aixianling
2024-08-19 14:36:26 +08:00
parent 4889f8bc09
commit f7c2d03428
2 changed files with 207 additions and 9 deletions

View File

@@ -2,7 +2,8 @@
import ChatContent from "./components/chatContent.vue";
import ThinkingBar from "./components/thinkingBar.vue";
import {mapState} from "vuex";
import AiDrag from "../../dv/AiDrag.vue";
import AiDrag from "../basic/AiDrag.vue";
import AiLocateDialog from "../tools/AiLocateDialog.vue";
export default {
name: "AiCopilot",
@@ -21,26 +22,34 @@ export default {
filter: "",
conversations: [],
currentConversation: null,
app: {}
app: {},
locate: false,
latlng: ""
}
},
computed: {
...mapState(["user"]),
profile: v => v.user.info || {},
expandBtn: v => v.expand ? "收起" : "展开",
btns: () => [
btns: v => [
{
label: "文件", icon: "https://cdn.sinoecare.com/i/2024/07/04/668663436e46e.png", click: () => {
}
},
{
label: "位置", icon: "https://cdn.sinoecare.com/i/2024/07/04/668663436e46e.png", click: () => {
v.locate = true
}
}
],
rowBtns: v => [
{icon: "https://cdn.sinoecare.com/i/2024/07/04/66866edc2910a.png", label: "置顶", click: row => 0},
{icon: "https://cdn.sinoecare.com/i/2024/07/04/66866ed734540.png", label: "编辑", click: row => 0},
{icon: "https://cdn.sinoecare.com/i/2024/07/04/66866eda99e4d.png", label: "删除", click: row => v.handleDeleteConversation(row.conversationId)},
]
],
dialogWidth: v => v.expand ? 960 : 468
},
components: {AiDrag, ThinkingBar, ChatContent},
components: {AiLocateDialog, AiDrag, ThinkingBar, ChatContent},
methods: {
getHistory(params) {
this.http.post("/app/appaicopilotinfo/list", null, {params}).then(res => {
@@ -81,8 +90,8 @@ export default {
if (++i < content.length) setTimeout(() => concatenateStr(content, i, target), 50)
}
this.$debounce(() => {
const {currentConversation: conversationId, app, prompt: content} = this.$data
const message = {appType: "2", userType: 0, content, conversationId, ...app}
const {currentConversation: conversationId, app, prompt: content, latlng} = this.$data
const message = {appType: "2", userType: 0, content, conversationId, ...app, supplementContent: latlng}
this.history.push(message)
this.loading = true
this.prompt = ""
@@ -122,6 +131,11 @@ export default {
return {
backgroundImage: `url(${icon})`
}
},
handleLocate(v) {
const {lat, lng} = v.location
this.latlng = [lat, lng].join(",")
this.locate = false
}
},
watch: {
@@ -141,7 +155,7 @@ export default {
<template>
<section class="AiCopilot">
<ai-drag class="copilot" v-if="show" :w="468" :h="600" :minHeight="600" :minWidth="468" :x="-480" :y="-542">
<ai-drag class="copilot" v-if="show" :w="dialogWidth" :h="600" :minHeight="600" :minWidth="dialogWidth" :x="-dialogWidth-12" :y="-542">
<div class="flex header">
<b class="fill" v-text="title"/>
<div class="expandBtn pointer" v-text="expandBtn" @click="expand=!expand"/>
@@ -183,6 +197,7 @@ export default {
</div>
</div>
</ai-drag>
<ai-locate-dialog v-model="locate" :ins="http" @confirm="v=>handleLocate(v)" :modal="false"/>
<img class="icon" src="https://cdn.sinoecare.com/i/2024/06/04/665ec6f5ef213.png" @click="show=!show"/>
</section>
</template>
@@ -252,14 +267,15 @@ export default {
.content {
height: calc(100% - 50px);
float: right;
.left {
width: 0;
height: 100%;
transition: width 1s;
padding: 14px 0;
overflow-x: hidden;
overflow-y: auto;
flex-shrink: 0;
& > * {
margin: 0 14px;
@@ -422,6 +438,7 @@ export default {
border-bottom: 1px solid #E0E0E0;
margin-bottom: 10px;
align-items: flex-start;
gap: 8px;
.btn {
font-size: 12px;