Home.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. <template>
  2. <div class="home-page">
  3. <div class="banner flex-center">
  4. <el-carousel :height="carouselHeight" style="width: 100%;">
  5. <el-carousel-item>
  6. <img
  7. :src="bannerImage"
  8. class="carousel-image"
  9. @load="onImageLoad"
  10. />
  11. </el-carousel-item>
  12. <el-carousel-item>
  13. <img
  14. :src="bannerImage"
  15. class="carousel-image"
  16. @load="onImageLoad"
  17. />
  18. </el-carousel-item>
  19. </el-carousel>
  20. </div>
  21. <!-- 中间搜索区域 -->
  22. <div class="workflow-container">
  23. <!-- 平台标识区域 -->
  24. <div class="platforms">
  25. <div class="platform-item" @click="activePlatform = 'n8n'" :class="{'active': activePlatform === 'n8n'}">
  26. <img :src="n8Icon" alt="" class="platform-icon n8n-icon">
  27. <span class="platform-name">n8n</span>
  28. </div>
  29. <div class="platform-item" @click="activePlatform = 'coze'" :class="{'active': activePlatform === 'coze'}">
  30. <img :src="cozeIcon" alt="" class="platform-icon n8n-icon">
  31. <span class="platform-name">Coze</span>
  32. </div>
  33. <div class="platform-item" @click="activePlatform = 'dify'" :class="{'active': activePlatform === 'dify'}">
  34. <img :src="difyIcon" alt="" class="platform-icon n8n-icon">
  35. <span class="platform-name">Dify</span>
  36. </div>
  37. <div class="platform-item" @click="activePlatform = 'fastgpt'" :class="{'active': activePlatform === 'fastgpt'}">
  38. <img :src="fastgptIcon" alt="" class="platform-icon n8n-icon">
  39. <span class="platform-name">FastGPT</span>
  40. </div>
  41. </div>
  42. <!-- 搜索与创建区域 -->
  43. <div class="search-create-bar" :class="{'notFirst': activePlatform !== 'n8n'}">
  44. <div class="search-input-container flex_1 gradient">
  45. <input
  46. type="text"
  47. :placeholder="$t('common.qingshuruyaosousuodegongzuoliu')"
  48. class="search-input"
  49. />
  50. <button class="search-btn gradient" @click.stop.prevent="goSearchPlatform">
  51. <img :src="searchIcon" alt="" class="icon-search">
  52. {{$t('common.shousuo')}}
  53. </button>
  54. </div>
  55. <button class="create-btn gradient" @click.stop.prevent="goWorkflowAdd">
  56. <img :src="addIcon" alt="" class="icon-add">
  57. {{$t('common.chuangjiangongzuoliu')}}
  58. </button>
  59. </div>
  60. </div>
  61. <!-- 工作流列表 -->
  62. <div class="course-list">
  63. <div class="course-grid">
  64. <div class="course-card" v-for="item in 4" :key="item">
  65. <div class="flex-center-between">
  66. <img :src="n8Icon" alt="" style="width: 50px; height: 50px;" class="mr10">
  67. <div class="line2 font_size14 line_height22 font_weight400">
  68. 【Linux】【操作】Linux操作集锦系列之十五——如何破解pdf如何破解pdf如何破解pdf如何破解pdf如何破解pdf
  69. </div>
  70. </div>
  71. <div class="mt16 gap10">
  72. <img :src="yunIcon" alt="" style="width: 16px; height: 16px;">
  73. <div class="font_size13">n8n平台</div>
  74. <img :src="riliIcon" alt="" style="width: 16px; height: 16px;">
  75. <div class="font_size13">2023-10-15</div>
  76. </div>
  77. <div class="mt16 line3 gray font_size13">
  78. - 本文介绍两款开源的密码破解工具John the Ripper和PDFCrack,用于破解PDF、Word、Excel、ZIP、RAR等文件的密码。John the Ripper支持字典和暴力破解两种模
  79. </div>
  80. <div class="gap10 mt16">
  81. <el-button type="primary" class="flex_1" size="large" plain>
  82. <el-icon class="mr10"><Document /></el-icon>
  83. 查看详情
  84. </el-button>
  85. <el-button type="primary" class="flex_1" size="large">
  86. <el-icon class="mr10"><VideoPlay /></el-icon>
  87. 开始使用
  88. </el-button>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </template>
  95. <script setup>
  96. import bannerImage from '@/assets/imgs/banner.png'
  97. import searchIcon from '@/assets/imgs/search.png'
  98. import addIcon from '@/assets/imgs/add.png'
  99. import n8Icon from '@/assets/imgs/8n8.png'
  100. import cozeIcon from '@/assets/imgs/coze.png'
  101. import difyIcon from '@/assets/imgs/dify.png'
  102. import fastgptIcon from '@/assets/imgs/FastGPT.png'
  103. import yunIcon from '@/assets/imgs/yun.png'
  104. import riliIcon from '@/assets/imgs/rili.png'
  105. import detailIcon from '@/assets/imgs/detail.png'
  106. import { onMounted,ref } from 'vue'
  107. import { useRouter } from 'vue-router'
  108. import { useI18n } from 'vue-i18n'
  109. const { t } = useI18n() // 获取t函数// 导入useI18n
  110. onMounted(() => {
  111. console.log('Home mounted')
  112. })
  113. const router = useRouter()
  114. const activePlatform = ref('n8n')
  115. // 监听图片加载完成,动态设置轮播图高度
  116. const carouselHeight = ref('auto')
  117. const onImageLoad = (event) => {
  118. const img = event.target
  119. const aspectRatio = img.naturalWidth / img.naturalHeight
  120. const containerWidth = img.offsetWidth
  121. const calculatedHeight = containerWidth / aspectRatio
  122. carouselHeight.value = calculatedHeight + 'px'
  123. }
  124. const goSearchPlatform = () => {
  125. //增加参数名称
  126. router.push({
  127. path: `/search-platform`,
  128. query: {
  129. activePlatform: activePlatform.value,
  130. metaTitle: activePlatform.value
  131. }
  132. })
  133. };
  134. const goWorkflowAdd = () => {
  135. //增加参数名称
  136. router.push({
  137. path: `workflow-add`,
  138. query: {
  139. }
  140. })
  141. };
  142. </script>
  143. <style lang="scss">
  144. .banner {
  145. // margin-top: 140px;
  146. height: calc(100vh - 60px);
  147. min-height: 600px;
  148. .carousel-image {
  149. width: 100%;
  150. height: auto;
  151. // object-fit: cover; // 保持比例填充整个容器
  152. // object-position: center; // 居中显示
  153. }
  154. }
  155. .icon-search{
  156. width: 24px;
  157. height: 24px;
  158. }
  159. .icon-add{
  160. width: 30px;
  161. height: 30px;
  162. }
  163. // 1. 定义全局变量,方便统一修改
  164. $primary-bg: rgba(255, 255, 255, 0.5);
  165. $white: #fff;
  166. $border-radius-base: 8px;
  167. $border-radius-sm: 8px;
  168. $border-radius-xs: 4px;
  169. $text-color-main: #333;
  170. $font-size-base: 14px;
  171. $font-size-sm: 12px;
  172. $gap-base: 8px;
  173. $gap-lg: 16px;
  174. $gap-xl: 24px;
  175. $padding-base: 20px;
  176. $height-btn: 50px;
  177. // 2. 混合器:按钮通用样式
  178. @mixin btn-style($bg-start, $bg-end) {
  179. padding: 0 16px;
  180. color: $white;
  181. border: none;
  182. border-radius: $border-radius-sm;
  183. cursor: pointer;
  184. display: flex;
  185. align-items: center;
  186. gap: $gap-base;
  187. font-size: 18px;
  188. &:hover {
  189. opacity: 0.9;
  190. }
  191. }
  192. // 3. 混合器:平台图标通用样式
  193. @mixin platform-icon-style($bg-color, $color: $white) {
  194. width: 24px;
  195. height: 24px;
  196. border-radius: $border-radius-xs;
  197. color: $color;
  198. display: flex;
  199. align-items: center;
  200. justify-content: center;
  201. }
  202. // 容器样式(SCSS嵌套)
  203. .workflow-container {
  204. padding: $padding-base;
  205. border-radius: $border-radius-base;
  206. width: 1100px;
  207. margin: $padding-base auto;
  208. // 平台区域嵌套
  209. .platforms {
  210. display: flex;
  211. position: relative;
  212. top: px;
  213. .platform-item {
  214. width: 120px;
  215. display: flex;
  216. align-items: center;
  217. justify-content: center;
  218. gap: 6px;
  219. padding: 8px 0;
  220. border-radius: $border-radius-sm $border-radius-sm 0 0;
  221. //手指
  222. cursor: pointer;
  223. &.active{
  224. background-color: $primary-bg;
  225. }
  226. .platform-icon {
  227. &.n8n-icon {
  228. @include platform-icon-style(#2563eb);
  229. font-size: $font-size-base;
  230. }
  231. &.coze-icon {
  232. @include platform-icon-style(#8b5cf6);
  233. font-size: $font-size-base;
  234. }
  235. &.dify-icon {
  236. @include platform-icon-style($white, $text-color-main);
  237. border: 1px solid #eee;
  238. font-size: $font-size-sm;
  239. }
  240. &.fastgpt-icon {
  241. @include platform-icon-style(#1e293b);
  242. font-size: $font-size-sm;
  243. }
  244. }
  245. .platform-name {
  246. font-size: $font-size-base;
  247. color: $text-color-main;
  248. }
  249. }
  250. }
  251. // 搜索创建栏嵌套
  252. .search-create-bar {
  253. display: flex;
  254. align-items: center;
  255. gap: $gap-base;
  256. background-color: $primary-bg;
  257. padding: 16px;
  258. border-radius: 0 $border-radius-base $border-radius-base $border-radius-base;
  259. &.notFirst{
  260. border-radius: $border-radius-base;
  261. }
  262. .search-input {
  263. flex: 1;
  264. height: 60px;
  265. padding: 0 12px;
  266. outline: none;
  267. font-size: 18px;
  268. border-radius:7px;
  269. border: none;
  270. width: 100%;
  271. //占位符的颜色
  272. ::placeholder {
  273. color: #999;
  274. }
  275. }
  276. .search-btn {
  277. height: 50px;
  278. @include btn-style(#0055FE, #2563eb);
  279. }
  280. .create-btn {
  281. height: 56px;
  282. @include btn-style(#a78bfa, #8b5cf6);
  283. }
  284. .search-input-container{
  285. position: relative;
  286. padding: 2px;
  287. border-radius: 8px;
  288. .search-btn{
  289. position: absolute;
  290. top: 6px;
  291. right: 16px;
  292. }
  293. }
  294. }
  295. }
  296. .home-page{
  297. .course-list{
  298. margin-top: 70px;
  299. .course-grid {
  300. display: grid;
  301. grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  302. gap: 20px;
  303. }
  304. .course-card {
  305. border: 1px solid #ffffff;
  306. background-color: rgba(255, 255, 255, 0.5);
  307. border-radius: 8px;
  308. padding: 16px;
  309. overflow: hidden;
  310. cursor: pointer;
  311. transition: transform 0.3s;
  312. &:hover {
  313. transform: translateY(-5px);
  314. box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  315. }
  316. }
  317. }
  318. }
  319. </style>