AIImageToImage.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <!-- 图生图 -->
  3. <div class="home-container">
  4. <!-- 展开收起侧边栏 -->
  5. <div
  6. class="icon-expand"
  7. :style="{
  8. backgroundColor: drawerVisible ? '#44449c' : '#7F70C840',
  9. left: drawerVisible ? '18%' : '0'
  10. }"
  11. @click="toggleDrawer"
  12. >
  13. <span
  14. class="vertical-lines"
  15. :style="{
  16. color: drawerVisible ? '#8a78d0' : 'white'
  17. }"
  18. >||</span
  19. >
  20. </div>
  21. <!-- 左侧折叠面板 -->
  22. <LeftPanel ref="leftPanelRef" v-if="drawerVisible"/>
  23. <div class="left-group2">
  24. <div class="title-box">
  25. <div class="box-icon" @click="goBack">
  26. <el-icon class="left-icon"><ArrowLeftBold /></el-icon>
  27. 图生图
  28. </div>
  29. </div>
  30. <div class="img-box">
  31. <p>
  32. <img
  33. style="width: fit-content; height: 180px; margin: 10px;"
  34. src="@/assets/images/color.png"
  35. class="avatar user"
  36. />
  37. </p>
  38. <p>期待你的画作喔~</p>
  39. </div>
  40. </div>
  41. <!-- 图生图 -->
  42. <imageToImage />
  43. </div>
  44. </template>
  45. <script setup>
  46. import { ref, onMounted } from 'vue'
  47. import { useRouter } from 'vue-router'
  48. import { ArrowLeftBold } from '@element-plus/icons-vue'
  49. import LeftPanel from '@/components/LeftPanel.vue'
  50. import imageToImage from '@/components/ai/image/imageToImage.vue'
  51. const router = useRouter()
  52. const leftPanelRef = ref(null)
  53. const drawerVisible = ref(true)
  54. // 切换抽屉显示状态
  55. const toggleDrawer = () => {
  56. drawerVisible.value = !drawerVisible.value
  57. }
  58. // 返回上一页
  59. const goBack = () => {
  60. router.push('/ai-laboratory')
  61. }
  62. </script>
  63. <style scoped lang="scss">
  64. @use 'sass:math';
  65. // 定义rpx转换函数
  66. @function rpx($px) {
  67. @return math.div($px, 750) * 100vw;
  68. }
  69. :deep(.el-image-viewer__wrapper) {
  70. z-index: 10000 !important;
  71. }
  72. .icon-expand {
  73. width: rpx(8);
  74. height: rpx(35);
  75. border-top-right-radius: rpx(5);
  76. border-bottom-right-radius: rpx(5);
  77. z-index: 9999;
  78. position: absolute;
  79. top: 50%;
  80. left: 18%;
  81. transform: translateY(-50%);
  82. background-color: #44449c;
  83. cursor: pointer; // 添加鼠标指针样式
  84. clip-path: polygon(0 0, 100% 15%, 100% 85%, 0 100%);
  85. display: flex;
  86. justify-content: center;
  87. align-items: center;
  88. transition: all 0.3s ease;
  89. }
  90. .icon-expand .vertical-lines {
  91. color: #8a78d0;
  92. font-size: rpx(10);
  93. }
  94. .home-container {
  95. position: fixed;
  96. top: 0;
  97. left: 0;
  98. right: 0;
  99. bottom: 0;
  100. display: flex;
  101. flex-direction: row;
  102. gap: rpx(0);
  103. background-color: #ece9fd;
  104. // background: linear-gradient(
  105. // to bottom,
  106. // #e2ddfc,
  107. // #f1effd
  108. // );
  109. }
  110. // 侧边栏
  111. .left-group2 {
  112. width: rpx(150);
  113. height: 100%;
  114. }
  115. .left-group2 img {
  116. width: rpx(110);
  117. height: auto;
  118. margin-top: rpx(30);
  119. }
  120. .title-box {
  121. height: rpx(50);
  122. }
  123. .box-icon {
  124. width: 100%;
  125. height: 100%;
  126. flex: 1;
  127. display: flex; // 添加 flex 布局
  128. align-items: center; // 垂直居中
  129. color: black; // 设置图标颜色为白色
  130. padding-left: rpx(15);
  131. font-size: rpx(10); // 设置图标大小,可按需调整
  132. cursor: pointer; // 添加鼠标指针样式
  133. }
  134. .box-icon .left-icon {
  135. margin-left: rpx(10);
  136. margin-right: rpx(5); // 设置图标和文字之间的间距 ;
  137. }
  138. .img-box {
  139. margin-top: rpx(50);
  140. color: #a39dce;
  141. }
  142. </style>