AIPainting.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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. src="@/assets/images/color.png"
  34. class="avatar user"
  35. />
  36. </p>
  37. <p>期待你的画作喔~</p>
  38. </div>
  39. </div>
  40. <!-- 右侧TextToImage组件 -->
  41. <TextToImage />
  42. </div>
  43. </template>
  44. <script setup>
  45. import { ref } from 'vue'
  46. import { useRouter } from 'vue-router'
  47. import { ArrowLeftBold } from '@element-plus/icons-vue'
  48. import LeftPanel from '@/components/LeftPanel.vue'
  49. import TextToImage from '@/components/ai/image/TextToImage.vue'
  50. import {homeRoutes} from "@/router/index.js";
  51. const router = useRouter()
  52. const leftPanelRef = ref(null)
  53. // 返回上一页
  54. const goBack = () => {
  55. router.push(homeRoutes.home);
  56. }
  57. // 添加抽屉显示状态
  58. const drawerVisible = ref(true)
  59. // 添加切换抽屉显示状态的函数
  60. const toggleDrawer = () => {
  61. drawerVisible.value = !drawerVisible.value
  62. }
  63. </script>
  64. <style scoped lang="scss">
  65. @use 'sass:math';
  66. // 定义rpx转换函数
  67. @function rpx($px) {
  68. @return math.div($px, 750) * 100vw;
  69. }
  70. /* 添加过渡样式 */
  71. .drawer-slide-enter-active,
  72. .drawer-slide-leave-active {
  73. transition: all 0.3s ease;
  74. }
  75. .drawer-slide-enter-from,
  76. .drawer-slide-leave-to {
  77. transform: translateX(-100%);
  78. opacity: 0;
  79. }
  80. :deep(.el-image-viewer__wrapper) {
  81. z-index: 10000 !important;
  82. }
  83. .icon-expand {
  84. width: rpx(8);
  85. height: rpx(35);
  86. border-top-right-radius: rpx(5);
  87. border-bottom-right-radius: rpx(5);
  88. z-index: 50;
  89. position: absolute;
  90. top: 50%;
  91. left: 18%;
  92. transform: translateY(-50%);
  93. background-color: #44449c;
  94. cursor: pointer; // 添加鼠标指针样式
  95. clip-path: polygon(0 0, 100% 15%, 100% 85%, 0 100%);
  96. display: flex;
  97. justify-content: center;
  98. align-items: center;
  99. transition: all 0.3s ease;
  100. }
  101. .icon-expand .vertical-lines {
  102. color: #8a78d0;
  103. font-size: rpx(10);
  104. }
  105. .menu-icon {
  106. width:rpx(11);
  107. height: rpx(11);
  108. margin-right: rpx(2);
  109. }
  110. // 侧边栏
  111. .left-group1 {
  112. width: rpx(135);
  113. height: 100%;
  114. background: linear-gradient(to bottom, #001169, #8a78d0);
  115. }
  116. .home-container {
  117. position: fixed;
  118. top: 0;
  119. left: 0;
  120. right: 0;
  121. bottom: 0;
  122. display: flex;
  123. flex-direction: row;
  124. gap: rpx(0);
  125. background: linear-gradient(
  126. to bottom,
  127. #e2ddfc,
  128. #f1effd
  129. ); /* 设置悬停、聚焦、点击状态下的背景色 */
  130. }
  131. // 侧边栏
  132. .left-group {
  133. width: rpx(135);
  134. height: 100%;
  135. background: linear-gradient(to bottom, #001169, #8a78d0);
  136. }
  137. .mb-2 {
  138. color: black;
  139. margin-top: rpx(1);
  140. }
  141. .tac ::v-deep(.el-menu) {
  142. background-color: transparent;
  143. border: none;
  144. width: 100%;
  145. margin-top: rpx(55);
  146. margin-left: rpx(10);
  147. }
  148. .el-menu-item {
  149. width: rpx(115);
  150. height: rpx(25);
  151. margin-bottom: rpx(5);
  152. border-radius: rpx(6);
  153. color: white;
  154. font-size: rpx(8);
  155. }
  156. .el-menu-item .el-icon svg {
  157. font-size: rpx(15);
  158. color: white;
  159. }
  160. .el-menu ::v-deep(.el-menu-item:hover),
  161. .el-menu ::v-deep(.el-menu-item:focus),
  162. .el-menu ::v-deep(.el-menu-item:active) {
  163. background: linear-gradient(
  164. to bottom,
  165. #ffefb0,
  166. #ffcc00
  167. ); /* 设置悬停、聚焦、点击状态下的背景色 */
  168. box-shadow: 0 8px 8px rgb(0, 0, 0, 0.3);
  169. color: black;
  170. font-size: rpx(8);
  171. }
  172. .el-menu-vertical-demo .el-menu-item.is-active {
  173. /* 可根据需求修改选中样式 */
  174. background: linear-gradient(
  175. to bottom,
  176. #ffefb0,
  177. #ffcc00
  178. ); /* 设置悬停、聚焦、点击状态下的背景色 */
  179. box-shadow: 0 8px 8px rgb(0, 0, 0, 0.3);
  180. color: black;
  181. font-size: rpx(8);
  182. }
  183. // 侧边栏
  184. .left-group2 {
  185. width: rpx(150);
  186. height: 100%;
  187. background-color: #ece9fd;
  188. }
  189. .left-group2 img {
  190. width: fit-content;
  191. height: rpx(100);
  192. margin: rpx(5);
  193. }
  194. .title-box {
  195. height: rpx(50);
  196. }
  197. .box-icon {
  198. width: 100%;
  199. height: 100%;
  200. flex: 1;
  201. display: flex; // 添加 flex 布局
  202. align-items: center; // 垂直居中
  203. color: black; // 设置图标颜色为白色
  204. padding-left: rpx(15);
  205. font-size: rpx(10); // 设置图标大小,可按需调整
  206. cursor: pointer; // 添加鼠标指针样式
  207. }
  208. // .box-icon .left-icon {
  209. // margin-left: rpx(10);
  210. // margin-right: rpx(5); // 设置图标和文字之间的间距 ;
  211. // }
  212. //左侧展览区图标
  213. .img-box {
  214. margin-top: rpx(50);
  215. color: #a39dce;
  216. }
  217. </style>