This commit is contained in:
2023-09-26 15:05:14 +08:00
parent d9868d5cf0
commit 98dc5cd8f7
8 changed files with 207 additions and 113 deletions

View File

@@ -205,7 +205,8 @@ export default defineComponent({
mounted(){
this.token = getCookie('token') || ''
this.uploadUrl = getUploadUrl()
let dropperDom = document.getElementsByClassName('vc-sketch-color-wrap')[0]
let dropperDom = document.getElementsByClassName("colorboard_upload_modal")[0].getElementsByClassName('vc-sketch-color-wrap')[0]
console.log( document.getElementsByClassName('vc-sketch-color-wrap'));
dropperDom.addEventListener('click',async ()=>{
try {
const dropper = new EyeDropper();

View File

@@ -582,7 +582,8 @@ export default defineComponent({
align-items: center;
flex-direction: column;
>img{
height: 100%;
// height: 100%;
width: 100%;
}
&.active{
flex-direction: row;

View File

@@ -2,7 +2,22 @@
<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="robot_text">{{item.str}}</div>
<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="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>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="robot_bottom">
@@ -45,7 +60,36 @@ 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 = {}
@@ -89,6 +133,9 @@ export default defineComponent({
},
methods: {
robotBtn(){
console.log(2323);
if(!this.robotTop||!this.robotInput){
this.robotTop = true
this.robotInput = true
@@ -97,22 +144,23 @@ export default defineComponent({
this.robotTop = false
this.robotInput = false
}
// let noRefresh = false;
// this.$router.push({ name: 'library', params: { noRefresh: false } });
this.textScroll()//聊天定位到最低部
this.createTimer()
},
textScroll(){
this.$nextTick(()=>{
if(this.robotDom && this.robotChildDom){
// const items = this.robotChildDom._rawValue
let num = 0
for (let index = 0; index < (this.$refs.robotChildDom as any).length; index++) {
const height = (this.$refs.robotChildDom as any)[index].clientHeight;
num = num+40+height
// const items = this.robotChildDom._rawValue
let num = 0
for (let index = 0; index < (this.$refs.robotChildDom as any).length; index++) {
const height = (this.$refs.robotChildDom as any)[index].clientHeight;
num = num+40+height
}
this.robotDom.scrollTop = num
}
this.robotDom.scrollTop = num
}
})
},
robotmax(){//点击内容就设置为true显示 重置定时器
this.createTimer()
@@ -128,13 +176,26 @@ export default defineComponent({
str:this.chatCentent
})
this.textScroll()
let sessionId
if(sessionStorage.getItem("sessionId") == null){
let randomNum:any = Math.floor(Math.random() * 9000000000000000) + 1000000000000000;
sessionStorage.setItem('sessionId', randomNum);
sessionId = randomNum
}else{
sessionId = sessionStorage.getItem("sessionId")
}
// 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":"session_1",
"session_id":sessionId,
"message" : this.chatCentent,
}
let interaction = {onDownloadProgress: (progressEvent:any) => {
@@ -155,6 +216,8 @@ 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
@@ -168,6 +231,35 @@ export default defineComponent({
});
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=>{
});
}
},
//创建定时器
createTimer() {
if (this.robotTop || this.robotInput) {
@@ -201,10 +293,11 @@ export default defineComponent({
z-index: 9999;
// width: 400px;
.robot_top{
// width: 70%;
width: 25rem;
// width: 25rem;
width: 30rem;
margin-left: auto;
height: 14rem;
height: 30rem;
// height: 20rem;
overflow-x: hidden;
transition: .3s all;
opacity: 0;
@@ -215,10 +308,60 @@ export default defineComponent({
&.robot_top::-webkit-scrollbar{display: none;}
.robot_text{
font-size: 1.4rem;
padding: .5rem 1rem;
padding: 1rem 1.5rem;
display: inline-block;
border-radius: 2rem;
max-width: 80%;
.robot_img{
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
.robot_img_item{
margin-bottom: 5%;
margin-right: 2.5%;
max-height: 100%;
position: relative;
width: 40%;
.delete_like_file_block{
display: none;
width: 3.2rem;
height: 3.2rem;
background: rgba(0,0,0,0.6);
border-radius: 0.4rem;
position: absolute;
top: 0rem;
right: 0rem;
text-align: center;
line-height: 3.2rem;
left: auto;
cursor: pointer;
i{
font-size: 1.6rem;
color: #fff;
&.fi-rr-heart{
}
&.fi-sr-heart{
color: red;
}
}
}
&:hover .delete_like_file_block{
display: block;
}
}
img{
width: 100%;
height: 8rem;
object-fit: contain;
cursor: auto;
// width: auto;
}
img:nth-child(2n-1){
// margin-right: 5%;
}
}
}
.text_left,.text_right{
margin: 2rem 0;