wangrong
2026-08-30 4c949c0dc9bcae785c281c9d8125295f09810b15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<script lang="ts" setup>
import dvAiWindowMax from '@/assets/svg/dv-ai-window-max.svg'
import dvAiWindowMin from '@/assets/svg/dv-ai-window-min.svg'
import { onMounted, ref } from 'vue'
import { useEmitt } from '@/hooks/web/useEmitt'
const aiDialogShow = ref(false)
 
const closeAi = () => {
  aiDialogShow.value = false
}
defineProps({
  baseUrl: {
    type: String
  }
})
 
const sizeChange = () => {
  sizeState.value = sizeState.value === 'min' ? 'max' : 'min'
}
 
const sizeState = ref('min')
 
onMounted(() => {
  useEmitt({
    name: 'aiComponentChange',
    callback: function () {
      aiDialogShow.value = !aiDialogShow.value
    }
  })
})
</script>
<template>
  <div
    class="ai-main"
    :class="{
      'ai-main-active': aiDialogShow,
      'ai-main-active-max': aiDialogShow && sizeState === 'max',
      'ai-main-active-min': aiDialogShow && sizeState === 'min'
    }"
  >
    <div class="ai-content">
      <el-icon class="close" @click="closeAi"><Close /></el-icon>
      <el-icon class="size-class" @click="sizeChange"
        ><Icon
          ><component
            :is="sizeState === 'min' ? dvAiWindowMin : dvAiWindowMax"
            class="svg-icon"
          ></component></Icon
      ></el-icon>
      <iframe :src="baseUrl" style="width: 100%; height: 100%" frameborder="0" allow="microphone">
      </iframe>
    </div>
  </div>
</template>
 
<style lang="less" scoped>
.ai-main {
  position: fixed;
  border-radius: 5px;
  border-top-right-radius: 0;
  overflow: hidden;
  height: 0;
  bottom: 48px;
  right: 36px;
  transition: 0.2s;
  z-index: 10;
  .ai-content {
    position: relative;
    width: 100%;
    height: 100%;
    .close {
      position: absolute;
      right: 12px;
      top: 16px;
      font-size: 24px;
      color: rgb(100, 106, 115);
      cursor: pointer;
    }
    .size-class {
      position: absolute;
      right: 50px;
      font-size: 16px;
      top: 20px;
      color: rgb(100, 106, 115);
      cursor: pointer;
    }
  }
}
.ai-main-active {
  border: 1px solid rgba(239, 240, 241, 1);
  box-shadow: 0px 6px 24px 0px #1f232914;
}
.ai-main-active-min {
  min-width: 350px;
  max-width: 420px;
  height: 50%;
  width: 25%;
  min-height: 540px;
  max-height: 600px;
  bottom: 48px;
  right: 36px;
}
 
.ai-main-active-max {
  height: 100%;
  width: 50%;
  bottom: 0px;
  right: 0px;
}
</style>