|
@@ -40,12 +40,24 @@
|
|
|
class="rounded-full w-14 h-14 object-cover"
|
|
|
/>
|
|
|
</div>
|
|
|
- <div class="message fex-1 ml-4 mt-2 p-2 rounded-r-md rounded-bl-md text-xs" >
|
|
|
- <div v-show="!item.content" class="loadingMessage" >
|
|
|
- <div v-loading="!item.content" element-loading-background="rgba(0, 0, 0, 0.0)"></div>
|
|
|
+ <div class="messageRight">
|
|
|
+ <!-- <div class="yyPlay ml-4"></div> -->
|
|
|
+ <div class="yyPlayBg mt-1 ml-6 w-16 p-1 cursor-pointer">
|
|
|
+ <img class="yyPlay" src="@/assets/images/播放/yyPlay.png" alt="">
|
|
|
+ </div>
|
|
|
+ <div class="message mt-4 ml-4 p-3 rounded-r-md rounded-bl-md text-xs" >
|
|
|
+ <div v-show="!item.content" class="loadingMessage" >
|
|
|
+ <div v-loading="!item.content" element-loading-background="rgba(0, 0, 0, 0.0)"></div>
|
|
|
+ </div>
|
|
|
+ <p v-show="item.content">{{ item.content }} </p>
|
|
|
+ <div class="messageOptions" v-show="returnMessage.length == 1">
|
|
|
+ <div class="option" v-for="(item, index) in messageOptions" :key="index" @click="messageOptionClick(item.chatGuidance)">
|
|
|
+ {{ item.chatGuidance }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <p v-show="item.content">{{ item.content }} </p>
|
|
|
</div>
|
|
|
+
|
|
|
</div>
|
|
|
<!-- 用户发送的信息 -->
|
|
|
<div v-if="item.role == 'user'" class="text-white mb-4 flex me" :key="index">
|
|
@@ -55,9 +67,12 @@
|
|
|
class="rounded-full w-14 h-14 object-cover"
|
|
|
/>
|
|
|
</div>
|
|
|
- <div class="message fex-1 mr-4 mt-2 p-2 rounded-l-md rounded-br-md text-xs">
|
|
|
- <p>{{ item.content }}</p>
|
|
|
+ <div class="messageRight">
|
|
|
+ <div class="message mr-4 mt-4 p-3 rounded-l-md rounded-br-md text-xs">
|
|
|
+ <p>{{ item.content }}</p>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
</div>
|
|
@@ -91,7 +106,7 @@
|
|
|
|
|
|
<script>
|
|
|
import Header from "@/views/homeComponents/Header.vue"
|
|
|
-import { streamChatWithWebApi } from "@/api/chat.js"
|
|
|
+import { streamChatWithWebApi, getGuidanceApi } from "@/api/chat.js"
|
|
|
import { detailApi } from "@/api/detail.js"
|
|
|
import { Message, MessageBox, Notification, Loading } from 'element-ui'
|
|
|
export default {
|
|
@@ -100,6 +115,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ messageOptions: [],
|
|
|
info: {},
|
|
|
messageLoading: false,
|
|
|
returnMessage: [],
|
|
@@ -138,6 +154,13 @@ export default {
|
|
|
})
|
|
|
localStorage.setItem(`[userId:${123},aiId:${this.info.id}]`, JSON.stringify(this.returnMessage));
|
|
|
}
|
|
|
+ this.getGuidance(id)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getGuidance(id) {
|
|
|
+ getGuidanceApi(id).then(res => {
|
|
|
+ console.log(res, '聊天引导');
|
|
|
+ this.messageOptions = res.data
|
|
|
})
|
|
|
},
|
|
|
goBack() {
|
|
@@ -301,6 +324,11 @@ export default {
|
|
|
this.noLogin(element)
|
|
|
break;
|
|
|
}
|
|
|
+ if(JSON.parse(element).code == 500) {
|
|
|
+ this.returnMessage.splice(this.returnMessage.length - 1, 1)
|
|
|
+ this.$message.error('系统错误请联系管理员')
|
|
|
+ break;
|
|
|
+ }
|
|
|
let txt = JSON.parse(element).content
|
|
|
this.returnMessage[this.returnMessage.length - 1].content += txt
|
|
|
}
|
|
@@ -340,6 +368,10 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ messageOptionClick(value) {
|
|
|
+ this.content = value
|
|
|
+ this.getStreamChatWithWeb()
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -473,12 +505,39 @@ export default {
|
|
|
.messages::-webkit-scrollbar {
|
|
|
width: 0px;
|
|
|
}
|
|
|
+.messageRight {
|
|
|
+ max-width: calc(100% - 72px);
|
|
|
+ min-width: 400px;
|
|
|
+}
|
|
|
+.yyPlayBg {
|
|
|
+ background: rgba(103, 103, 168, 1);
|
|
|
+ border-radius: 999px;
|
|
|
+ position: absolute;
|
|
|
+}
|
|
|
+
|
|
|
+.yyPlay {
|
|
|
+ width: 12px;
|
|
|
+ height: 12px;
|
|
|
+ // background: url('../../assets/images/播放/yyPlay.gif') no-repeat;
|
|
|
+ // background-size: 170% 170%;
|
|
|
+ // background-position: 50% 50%;
|
|
|
+ // animation: heart-burst steps(28) 0.9s infinite both;
|
|
|
+ // animation-play-state: paused;
|
|
|
+ // height: 50px;
|
|
|
+ // background: #fff;
|
|
|
+}
|
|
|
.message {
|
|
|
background: #ffffff0f;
|
|
|
border: 1px solid #5b5b5e;
|
|
|
- max-width: calc(100% - 72px);
|
|
|
+
|
|
|
// flex: 1;
|
|
|
- min-width: 80px;
|
|
|
+
|
|
|
+}
|
|
|
+.messageUser {
|
|
|
+ background: #ffffff0f;
|
|
|
+ border: 1px solid #5b5b5e;
|
|
|
+ max-width: calc(100% - 72px);
|
|
|
+ min-width: 400px;
|
|
|
}
|
|
|
.photo {
|
|
|
width: 56px;
|
|
@@ -493,6 +552,22 @@ export default {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
+.messageOptions {
|
|
|
+ // margin-top: 20px;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ justify-content: space-around;
|
|
|
+ .option {
|
|
|
+ background: #ade4ff32;
|
|
|
+ border: 1px solid #5b5b5e;
|
|
|
+ border-radius: 10px;
|
|
|
+ padding: 10px;
|
|
|
+ width: 40%;
|
|
|
+ height: 50px;
|
|
|
+ margin-top: 10px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|
|
|
<style scoped>
|
|
|
.loadingMessage >>> .el-loading-parent--relative {
|