Skip to content

Commit f1f0329

Browse files
committed
feat:接入讯飞星火AI客服
1 parent 7e6e7e4 commit f1f0329

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

Diff for: src/App.vue

+3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
<router-view class="body" />
66
<QrCode></QrCode>
77
<Footer />
8+
<AiChatbot />
89
</div>
910
</template>
1011

1112
<script>
1213
import Header from "./views/Header.vue";
1314
import Footer from "./views/Footer.vue";
1415
import QrCode from "./views/QrCode.vue";
16+
import AiChatbot from "./components/AiChatbot.vue";
1517
1618
export default {
1719
name: "App",
@@ -20,6 +22,7 @@ export default {
2022
Header,
2123
Footer,
2224
QrCode,
25+
AiChatbot,
2326
},
2427
};
2528
</script>

Diff for: src/components/AiChatbot.vue

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<template>
2+
<div class="ai-chatbot">
3+
<div class="chatbot-icon" @click="toggleChat">
4+
<img src="https://www.svgrepo.com/show/306500/robot.svg" alt="AI" />
5+
</div>
6+
<div class="chatbot-dialog" v-show="isOpen">
7+
<div class="dialog-header">
8+
<span>AI</span>
9+
<span class="close-btn" @click="toggleChat">×</span>
10+
</div>
11+
<iframe
12+
src="http://localhost/chatbot/88n14yNFATs9MNtT"
13+
frameborder="0"
14+
allow="microphone"
15+
></iframe>
16+
</div>
17+
</div>
18+
</template>
19+
20+
<script setup>
21+
import { ref } from 'vue';
22+
23+
const isOpen = ref(false);
24+
25+
const toggleChat = () => {
26+
isOpen.value = !isOpen.value;
27+
};
28+
</script>
29+
30+
<style scoped>
31+
.ai-chatbot {
32+
position: fixed;
33+
right: 20px;
34+
bottom: 20px;
35+
z-index: 1000;
36+
}
37+
38+
.chatbot-icon {
39+
width: 60px;
40+
height: 60px;
41+
background: #32ca99;
42+
border-radius: 50%;
43+
cursor: pointer;
44+
display: flex;
45+
align-items: center;
46+
justify-content: center;
47+
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
48+
transition: transform 0.3s ease;
49+
}
50+
51+
.chatbot-icon:hover {
52+
transform: scale(1.1);
53+
}
54+
55+
.chatbot-icon img {
56+
width: 32px;
57+
height: 32px;
58+
filter: brightness(0) invert(1);
59+
}
60+
61+
.chatbot-dialog {
62+
position: fixed;
63+
right: 20px;
64+
bottom: 100px;
65+
width: 380px;
66+
height: 600px;
67+
background: #fff;
68+
border-radius: 12px;
69+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
70+
overflow: hidden;
71+
}
72+
73+
.dialog-header {
74+
display: flex;
75+
justify-content: space-between;
76+
align-items: center;
77+
padding: 12px 16px;
78+
background: #32ca99;
79+
color: #fff;
80+
font-size: 16px;
81+
}
82+
83+
.close-btn {
84+
cursor: pointer;
85+
font-size: 24px;
86+
line-height: 1;
87+
}
88+
89+
.close-btn:hover {
90+
opacity: 0.8;
91+
}
92+
93+
iframe {
94+
width: 100%;
95+
height: calc(100% - 44px);
96+
border: none;
97+
}
98+
</style>

0 commit comments

Comments
 (0)