This commit is contained in:
2023-10-11 17:34:14 +08:00
parent 98dc5cd8f7
commit 268ffecff7
35 changed files with 1947 additions and 878 deletions

View File

@@ -1,25 +1,28 @@
<template>
<div class="robot" @mousemove="robotmax">
<div class="robot_top" ref="robotDom" v-fade="robotTop,'block'">
<div :class="[item.state == 1?'text_right':'text_left']" v-for="item in record" ref="robotChildDom">
<div :class="[item.state == 1?'text_right':'text_left',item.img?'white':'']" v-for="item,index in record" ref="robotChildDom">
<div class="robot_text">
<span>
{{item.str}}
</span>
<div class="robot_img">
<div class="robot_img_item" v-for="imgItem in item.img">
<img :src="imgItem.url" alt="">
<div class="robot_img" :class="[item.img ?'img':'']">
<div class="robot_img_item" v-for="imgItem,imgIndex in item.img">
<img :src="imgItem.presignedUrl" alt="">
<div
class="delete_like_file_block"
>
<i v-if="!item.like" class="fi fi-rr-heart" @click.stop="likeFile(item,'like')"></i>
<i v-else class="fi fi-sr-heart" @click.stop="likeFile(item,'noLike')"></i>
<i v-if="imgItem.id == null" class="fi fi-rr-heart" @click.stop="likeFile(imgItem,imgIndex,index)"></i>
<i v-else class="fi fi-sr-heart" @click.stop="likeFile(imgItem,imgIndex,index)"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="robot_content">
<div :style="'width:'+bloodBars+'%;'"></div>
</div>
<div class="robot_bottom">
<div class="robot_input" v-fade="robotInput,'flex'">
<input
@@ -60,39 +63,10 @@ export default defineComponent({
let timeTop:any = 0;
let timeInput:any = 0;
let record:any = ref([
{
state:1,
str:"1111111111"
},
{
state:2,
str:"2222222222222"
},
{
state:1,
str:"1111111111"
},
{
state:2,
str:"2222222222222"
},
{
state:1,
str:"1111111111",
img:[
{url:'http://18.167.251.121:9000/aida-clothing/image/image_1695621083.572033.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minioadmin%2F20230926%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230926T064349Z&X-Amz-Expires=28800&X-Amz-SignedHeaders=host&X-Amz-Signature=74f33d78f94925b1cd2e0198efad99432d7f285f951d5fc1ac11bf77fc802238'},
{url:'http://18.167.251.121:9000/aida-clothing/image/image_1695621083.572033.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minioadmin%2F20230926%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230926T064349Z&X-Amz-Expires=28800&X-Amz-SignedHeaders=host&X-Amz-Signature=74f33d78f94925b1cd2e0198efad99432d7f285f951d5fc1ac11bf77fc802238'},
{url:'http://18.167.251.121:9000/aida-clothing/image/image_1695621083.572033.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minioadmin%2F20230926%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230926T064349Z&X-Amz-Expires=28800&X-Amz-SignedHeaders=host&X-Amz-Signature=74f33d78f94925b1cd2e0198efad99432d7f285f951d5fc1ac11bf77fc802238'},
{url:'http://18.167.251.121:9000/aida-clothing/image/image_1695621083.572033.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minioadmin%2F20230926%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230926T064349Z&X-Amz-Expires=28800&X-Amz-SignedHeaders=host&X-Amz-Signature=74f33d78f94925b1cd2e0198efad99432d7f285f951d5fc1ac11bf77fc802238'},
]
},
{
state:2,
str:"2222222222222"
},
])
const userInfo:any = {}
let bloodBars:any = ref(0)
return {
robotTop,
robotInput,
@@ -103,6 +77,7 @@ export default defineComponent({
timeTop,
timeInput,
userInfo,
bloodBars,
};
},
data() {
@@ -113,6 +88,13 @@ export default defineComponent({
this.textScroll()
let userInfo:any = getCookie("userInfo")
this.userInfo = JSON.parse(userInfo);
if (sessionStorage.getItem("record") == null) {
this.record = []
}else{
this.record = JSON.parse(sessionStorage.getItem("record") as string)
}
this.getBloodBars()
},
directives:{
fade:{
@@ -133,9 +115,6 @@ export default defineComponent({
},
methods: {
robotBtn(){
console.log(2323);
if(!this.robotTop||!this.robotInput){
this.robotTop = true
this.robotInput = true
@@ -149,6 +128,13 @@ export default defineComponent({
this.textScroll()//聊天定位到最低部
this.createTimer()
},
getBloodBars(){
Https.axiosGet(Https.httpUrls.getBloodBars,{params:{userId:this.userInfo.userId}}).then((rv: any) => {
if (rv) {
this.bloodBars = rv*100
}
})
},
textScroll(){
this.$nextTick(()=>{
if(this.robotDom && this.robotChildDom){
@@ -187,14 +173,9 @@ export default defineComponent({
// sessionStorage.setItem('username', '23123123123');
// sessionStorage.getItem("username")
// sessionStorage.removeItem
console.log(sessionId);
let a = true
let data = {
"user_id" : this.userInfo.userId,
// "message" : this.chatCentent,
// // "message" : "Hello, can you tell me what holiday is on July 1st",
// "session_id":""
"session_id":sessionId,
"message" : this.chatCentent,
}
@@ -216,49 +197,43 @@ export default defineComponent({
// Https.axiosPost(Https.httpUrls.pythonChatStream, data,interaction).then(
(rv) => {
if(rv){
console.log(rv);
this.record.push({
state:1,
str:rv.output
})
if(rv.chatRobotLibraryList != null){
this.record.push({
state:1,
img:rv.chatRobotLibraryList
})
}else{
this.record.push({
state:1,
str:rv.output,
})
}
sessionStorage.setItem('record', JSON.stringify(this.record));
this.createTimer()
this.textScroll()
this.getBloodBars()
}
}
).catch(res=>{
// console.log(res,'res');
});
this.chatCentent = ""
},
likeFile(item:any,str:string){
if(str == 'like'){
let data = {
generateDetailId:item.id,
level1Type:"Moodboard",
level2Type: '',
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone
}
Https.axiosPost(Https.httpUrls.generateLike, data).then(
(rv) => {
console.log(rv);
item.like = true
}
).catch(res=>{
});
}else{
let data = {
generateDetailId:item.id,
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone
}
Https.axiosGet(Https.httpUrls.generateDislike, {params:data}).then(
(rv) => {
item.like = false
}
).catch(res=>{
});
likeFile(item:any,imgIndex:number,index:number){
let data = {
...item,
"userId" : this.userInfo.userId,
}
Https.axiosPost(Https.httpUrls.pictureLikeOrUnLike, data).then(
(rv) => {
if(this.record[index].img[imgIndex].id == null){
this.record[index].img[imgIndex].id = rv.id
}else{
this.record[index].img[imgIndex].id = null
}
sessionStorage.setItem('record', JSON.stringify(this.record));
}
).catch(res=>{
});
},
//创建定时器
createTimer() {
@@ -296,11 +271,12 @@ export default defineComponent({
// width: 25rem;
width: 30rem;
margin-left: auto;
height: 30rem;
// height: 20rem;
overflow-x: hidden;
transition: .3s all;
opacity: 0;
height: auto;
max-height: 30rem;
display: none;
&.active{
opacity: 1;
@@ -317,12 +293,16 @@ export default defineComponent({
flex-wrap: wrap;
align-items: center;
justify-content: center;
&.img{
width: 18rem;
}
.robot_img_item{
margin-bottom: 5%;
margin-right: 2.5%;
max-height: 100%;
position: relative;
width: 40%;
overflow: hidden;
margin: 0 5%;
margin-bottom: 5%;
.delete_like_file_block{
display: none;
width: 3.2rem;
@@ -382,8 +362,36 @@ export default defineComponent({
background-color: #835ff7;
color: #fff;
}
&.white{
>div{
background-color: #fff;
}
}
}
}
.robot_content{
opacity: 0;
width: 8rem;
height: 1.1rem;
border-radius: 2rem;
overflow: hidden;
border: .2rem solid;
background: #341e57;
display: flex;
justify-content: flex-end;
margin-left: auto;
transition: all .3s;
>div{
background: linear-gradient(45deg, #eee4f3, #f3f4e6);
height: 100%;
width: 80%;
border-radius: 2rem;
}
}
&.robot:hover .robot_content{
opacity: 1;
}
.robot_bottom{
display: flex;
align-items: center;