HelloWorld.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  1. <template>
  2. <div class="home-page">
  3. <!-- 导航栏 -->
  4. <el-header class="navbar">
  5. <div class="nav-container">
  6. <div class="nav-left">
  7. <div class="logo">
  8. <el-icon class="logo-icon"><Platform /></el-icon>
  9. <span class="logo-text">API开放平台</span>
  10. </div>
  11. <el-menu
  12. mode="horizontal"
  13. :default-active="activeNav"
  14. class="nav-menu"
  15. @select="handleNavSelect"
  16. >
  17. <el-menu-item index="home">首页</el-menu-item>
  18. <el-menu-item index="docs">文档中心</el-menu-item>
  19. <el-menu-item index="pricing">价格方案</el-menu-item>
  20. <el-menu-item index="support">技术支持</el-menu-item>
  21. </el-menu>
  22. </div>
  23. <div class="nav-right">
  24. <el-button type="primary" @click="handleLogin">立即登录</el-button>
  25. <el-button @click="handleRegister">免费注册</el-button>
  26. </div>
  27. </div>
  28. </el-header>
  29. <!-- 主内容区域 -->
  30. <main class="main-content">
  31. <!-- 英雄区域 -->
  32. <section class="hero-section">
  33. <div class="hero-container">
  34. <div class="hero-content">
  35. <h1 class="hero-title">
  36. 强大的API接口服务
  37. <br>
  38. <span class="highlight">赋能您的业务创新</span>
  39. </h1>
  40. <p class="hero-description">
  41. 提供稳定、安全、高效的API接口服务,支持多种数据格式和认证方式,
  42. 助力开发者快速构建应用程序
  43. </p>
  44. <div class="hero-actions">
  45. <el-button type="primary" size="large" @click="handleGetStarted">
  46. 立即开始
  47. <el-icon><ArrowRight /></el-icon>
  48. </el-button>
  49. <el-button size="large" @click="handleViewDocs">
  50. 查看文档
  51. </el-button>
  52. </div>
  53. <div class="hero-stats">
  54. <div class="stat-item">
  55. <div class="stat-number">500+</div>
  56. <div class="stat-label">可用接口</div>
  57. </div>
  58. <div class="stat-item">
  59. <div class="stat-number">99.9%</div>
  60. <div class="stat-label">服务可用性</div>
  61. </div>
  62. <div class="stat-item">
  63. <div class="stat-number">10,000+</div>
  64. <div class="stat-label">开发者用户</div>
  65. </div>
  66. </div>
  67. </div>
  68. <div class="hero-visual">
  69. <div class="api-visual">
  70. <div class="code-window">
  71. <div class="window-header">
  72. <div class="window-dots">
  73. <span class="dot red"></span>
  74. <span class="dot yellow"></span>
  75. <span class="dot green"></span>
  76. </div>
  77. <span class="window-title">api_example.js</span>
  78. </div>
  79. <div class="code-content">
  80. <pre><code>// 调用用户信息接口
  81. fetch('/api/v1/users/123', {
  82. method: 'GET',
  83. headers: {
  84. 'Authorization': 'Bearer your-api-key',
  85. 'Content-Type': 'application/json'
  86. }
  87. })
  88. .then(response => response.json())
  89. .then(data => console.log(data));</code></pre>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. </section>
  96. <!-- 特性介绍 -->
  97. <section class="features-section">
  98. <div class="container">
  99. <div class="section-header">
  100. <h2>为什么选择我们的API平台</h2>
  101. <p>我们提供全方位的API服务解决方案</p>
  102. </div>
  103. <div class="features-grid">
  104. <el-card class="feature-card" shadow="hover">
  105. <div class="feature-icon">
  106. <el-icon><Lock /></el-icon>
  107. </div>
  108. <h3>安全可靠</h3>
  109. <p>多重安全认证机制,数据加密传输,保障您的数据安全</p>
  110. </el-card>
  111. <el-card class="feature-card" shadow="hover">
  112. <div class="feature-icon">
  113. <el-icon><TrendCharts /></el-icon>
  114. </div>
  115. <h3>高性能</h3>
  116. <p>分布式架构,负载均衡,确保API接口的高性能和稳定性</p>
  117. </el-card>
  118. <el-card class="feature-card" shadow="hover">
  119. <div class="feature-icon">
  120. <el-icon><Document /></el-icon>
  121. </div>
  122. <h3>完善文档</h3>
  123. <p>详细的API文档和示例代码,帮助您快速上手集成</p>
  124. </el-card>
  125. <el-card class="feature-card" shadow="hover">
  126. <div class="feature-icon">
  127. <el-icon><Headset /></el-icon>
  128. </div>
  129. <h3>专业支持</h3>
  130. <p>7x24小时技术支持,专业团队为您解决技术问题</p>
  131. </el-card>
  132. </div>
  133. </div>
  134. </section>
  135. <!-- API分类 -->
  136. <section class="categories-section">
  137. <div class="container">
  138. <div class="section-header">
  139. <h2>丰富的API接口</h2>
  140. <p>覆盖多个领域的API服务</p>
  141. </div>
  142. <div class="categories-grid">
  143. <div class="category-item">
  144. <div class="category-icon user">
  145. <el-icon><User /></el-icon>
  146. </div>
  147. <h4>用户管理</h4>
  148. <p>用户注册、登录、信息管理等接口</p>
  149. </div>
  150. <div class="category-item">
  151. <div class="category-icon data">
  152. <el-icon><DataAnalysis /></el-icon>
  153. </div>
  154. <h4>数据分析</h4>
  155. <p>数据统计、分析、可视化接口</p>
  156. </div>
  157. <div class="category-item">
  158. <div class="category-icon payment">
  159. <el-icon><Money /></el-icon>
  160. </div>
  161. <h4>支付服务</h4>
  162. <p>多种支付方式接入接口</p>
  163. </div>
  164. <div class="category-item">
  165. <div class="category-icon message">
  166. <el-icon><ChatDotRound /></el-icon>
  167. </div>
  168. <h4>消息推送</h4>
  169. <p>短信、邮件、推送通知接口</p>
  170. </div>
  171. <div class="category-item">
  172. <div class="category-icon storage">
  173. <el-icon><Folder /></el-icon>
  174. </div>
  175. <h4>文件存储</h4>
  176. <p>文件上传、下载、管理接口</p>
  177. </div>
  178. <div class="category-item">
  179. <div class="category-icon ai">
  180. <el-icon><Cpu /></el-icon>
  181. </div>
  182. <h4>人工智能</h4>
  183. <p>AI模型调用、图像识别接口</p>
  184. </div>
  185. </div>
  186. </div>
  187. </section>
  188. <!-- CTA区域 -->
  189. <section class="cta-section">
  190. <div class="container">
  191. <div class="cta-content">
  192. <h2>立即开始使用我们的API服务</h2>
  193. <p>注册即可获得免费额度,快速集成到您的应用中</p>
  194. <div class="cta-actions">
  195. <el-button type="primary" size="large" @click="handleRegister">
  196. 免费注册
  197. </el-button>
  198. <el-button size="large" @click="handleContact">
  199. 联系销售
  200. </el-button>
  201. </div>
  202. </div>
  203. </div>
  204. </section>
  205. </main>
  206. <!-- 页脚 -->
  207. <el-footer class="footer">
  208. <div class="container">
  209. <div class="footer-content">
  210. <div class="footer-section">
  211. <div class="footer-logo">
  212. <el-icon><Platform /></el-icon>
  213. <span>API开放平台</span>
  214. </div>
  215. <p class="footer-description">
  216. 专业的API接口服务平台,为开发者提供稳定可靠的接口服务
  217. </p>
  218. </div>
  219. <div class="footer-section">
  220. <h4>产品</h4>
  221. <ul>
  222. <li><a href="#">接口市场</a></li>
  223. <li><a href="#">价格方案</a></li>
  224. <li><a href="#">文档中心</a></li>
  225. <li><a href="#">状态监控</a></li>
  226. </ul>
  227. </div>
  228. <div class="footer-section">
  229. <h4>支持</h4>
  230. <ul>
  231. <li><a href="#">技术支持</a></li>
  232. <li><a href="#">常见问题</a></li>
  233. <li><a href="#">开发者社区</a></li>
  234. <li><a href="#">服务条款</a></li>
  235. </ul>
  236. </div>
  237. <div class="footer-section">
  238. <h4>联系我们</h4>
  239. <ul>
  240. <li><a href="#">商务合作</a></li>
  241. <li><a href="#">意见反馈</a></li>
  242. <li><a href="#">加入我们</a></li>
  243. </ul>
  244. </div>
  245. </div>
  246. <div class="footer-bottom">
  247. <p>&copy; 2024 API开放平台. 保留所有权利.</p>
  248. </div>
  249. </div>
  250. </el-footer>
  251. </div>
  252. </template>
  253. <script setup>
  254. import { ref } from 'vue'
  255. import { useRouter } from 'vue-router'
  256. import {
  257. Platform,
  258. ArrowRight,
  259. Lock,
  260. TrendCharts,
  261. Document,
  262. Headset,
  263. User,
  264. DataAnalysis,
  265. Money,
  266. ChatDotRound,
  267. Folder,
  268. Cpu
  269. } from '@element-plus/icons-vue'
  270. const router = useRouter()
  271. const activeNav = ref('home')
  272. // 导航菜单选择
  273. const handleNavSelect = (index) => {
  274. activeNav.value = index
  275. // 这里可以添加页面内滚动或路由跳转逻辑
  276. }
  277. // 登录按钮点击
  278. const handleLogin = () => {
  279. router.push('/login')
  280. }
  281. // 注册按钮点击
  282. const handleRegister = () => {
  283. // 可以跳转到注册页面或打开注册模态框
  284. console.log('打开注册')
  285. }
  286. // 立即开始
  287. const handleGetStarted = () => {
  288. handleRegister()
  289. }
  290. // 查看文档
  291. const handleViewDocs = () => {
  292. // 跳转到文档页面
  293. console.log('查看文档')
  294. }
  295. // 联系销售
  296. const handleContact = () => {
  297. // 打开联系表单
  298. console.log('联系销售')
  299. }
  300. </script>
  301. <style scoped>
  302. /* 修复全屏显示问题 */
  303. .home-page {
  304. min-height: 100vh;
  305. display: flex;
  306. flex-direction: column;
  307. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  308. }
  309. .navbar {
  310. background: rgba(255, 255, 255, 0.95);
  311. backdrop-filter: blur(10px);
  312. border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  313. padding: 0;
  314. height: 64px;
  315. flex-shrink: 0; /* 防止导航栏被压缩 */
  316. }
  317. .nav-container {
  318. display: flex;
  319. justify-content: space-between;
  320. align-items: center;
  321. max-width: 1200px;
  322. margin: 0 auto;
  323. padding: 0 20px;
  324. height: 100%;
  325. }
  326. .nav-left {
  327. display: flex;
  328. align-items: center;
  329. gap: 40px;
  330. }
  331. .logo {
  332. display: flex;
  333. align-items: center;
  334. gap: 8px;
  335. font-size: 20px;
  336. font-weight: 700;
  337. color: #303133;
  338. }
  339. .logo-icon {
  340. font-size: 24px;
  341. color: #409EFF;
  342. }
  343. .nav-menu {
  344. border-bottom: none;
  345. background: transparent;
  346. }
  347. .nav-right {
  348. display: flex;
  349. gap: 12px;
  350. }
  351. .main-content {
  352. flex: 1; /* 使主内容区域占据剩余空间 */
  353. width: 100%;
  354. }
  355. /* 英雄区域 */
  356. .hero-section {
  357. padding: 100px 0 80px;
  358. color: white;
  359. width: 100%;
  360. }
  361. .hero-container {
  362. max-width: 1200px;
  363. margin: 0 auto;
  364. padding: 0 20px;
  365. display: grid;
  366. grid-template-columns: 1fr 1fr;
  367. gap: 60px;
  368. align-items: center;
  369. width: 100%;
  370. }
  371. .hero-title {
  372. font-size: 3.5rem;
  373. font-weight: 700;
  374. line-height: 1.2;
  375. margin-bottom: 24px;
  376. }
  377. .highlight {
  378. background: linear-gradient(45deg, #ffd700, #ff6b6b);
  379. -webkit-background-clip: text;
  380. -webkit-text-fill-color: transparent;
  381. background-clip: text;
  382. }
  383. .hero-description {
  384. font-size: 1.25rem;
  385. line-height: 1.6;
  386. margin-bottom: 32px;
  387. opacity: 0.9;
  388. }
  389. .hero-actions {
  390. display: flex;
  391. gap: 16px;
  392. margin-bottom: 48px;
  393. }
  394. .hero-stats {
  395. display: flex;
  396. gap: 40px;
  397. }
  398. .stat-item {
  399. text-align: center;
  400. }
  401. .stat-number {
  402. font-size: 2rem;
  403. font-weight: 700;
  404. margin-bottom: 4px;
  405. }
  406. .stat-label {
  407. font-size: 0.9rem;
  408. opacity: 0.8;
  409. }
  410. /* API可视化 */
  411. .api-visual {
  412. display: flex;
  413. justify-content: center;
  414. }
  415. .code-window {
  416. background: #1e1e1e;
  417. border-radius: 12px;
  418. overflow: hidden;
  419. box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  420. max-width: 500px;
  421. width: 100%;
  422. }
  423. .window-header {
  424. background: #2d2d2d;
  425. padding: 12px 16px;
  426. display: flex;
  427. align-items: center;
  428. gap: 8px;
  429. }
  430. .window-dots {
  431. display: flex;
  432. gap: 6px;
  433. }
  434. .dot {
  435. width: 12px;
  436. height: 12px;
  437. border-radius: 50%;
  438. }
  439. .dot.red { background: #ff5f56; }
  440. .dot.yellow { background: #ffbd2e; }
  441. .dot.green { background: #27ca3f; }
  442. .window-title {
  443. color: #ccc;
  444. font-size: 0.9rem;
  445. }
  446. .code-content {
  447. padding: 24px;
  448. }
  449. .code-content pre {
  450. margin: 0;
  451. color: #d4d4d4;
  452. font-family: 'Monaco', 'Consolas', monospace;
  453. font-size: 14px;
  454. line-height: 1.5;
  455. overflow-x: auto;
  456. }
  457. /* 特性区域 */
  458. .features-section {
  459. padding: 80px 0;
  460. background: white;
  461. width: 100%;
  462. }
  463. .container {
  464. max-width: 1200px;
  465. margin: 0 auto;
  466. padding: 0 20px;
  467. width: 100%;
  468. }
  469. .section-header {
  470. text-align: center;
  471. margin-bottom: 60px;
  472. }
  473. .section-header h2 {
  474. font-size: 2.5rem;
  475. font-weight: 700;
  476. color: #303133;
  477. margin-bottom: 16px;
  478. }
  479. .section-header p {
  480. font-size: 1.1rem;
  481. color: #606266;
  482. }
  483. .features-grid {
  484. display: grid;
  485. grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  486. gap: 24px;
  487. }
  488. .feature-card {
  489. text-align: center;
  490. padding: 32px 24px;
  491. border: none;
  492. transition: transform 0.3s ease;
  493. }
  494. .feature-card:hover {
  495. transform: translateY(-8px);
  496. }
  497. .feature-icon {
  498. width: 80px;
  499. height: 80px;
  500. margin: 0 auto 24px;
  501. background: linear-gradient(135deg, #409EFF, #67C23A);
  502. border-radius: 50%;
  503. display: flex;
  504. align-items: center;
  505. justify-content: center;
  506. }
  507. .feature-icon .el-icon {
  508. font-size: 32px;
  509. color: white;
  510. }
  511. .feature-card h3 {
  512. font-size: 1.5rem;
  513. font-weight: 600;
  514. margin-bottom: 16px;
  515. color: #303133;
  516. }
  517. .feature-card p {
  518. color: #606266;
  519. line-height: 1.6;
  520. }
  521. /* 分类区域 */
  522. .categories-section {
  523. padding: 80px 0;
  524. background: #f5f7fa;
  525. width: 100%;
  526. }
  527. .categories-grid {
  528. display: grid;
  529. grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  530. gap: 32px;
  531. }
  532. .category-item {
  533. text-align: center;
  534. padding: 32px 24px;
  535. background: white;
  536. border-radius: 12px;
  537. transition: all 0.3s ease;
  538. }
  539. .category-item:hover {
  540. transform: translateY(-4px);
  541. box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  542. }
  543. .category-icon {
  544. width: 80px;
  545. height: 80px;
  546. margin: 0 auto 20px;
  547. border-radius: 50%;
  548. display: flex;
  549. align-items: center;
  550. justify-content: center;
  551. font-size: 32px;
  552. color: white;
  553. }
  554. .category-icon.user { background: #409EFF; }
  555. .category-icon.data { background: #67C23A; }
  556. .category-icon.payment { background: #E6A23C; }
  557. .category-icon.message { background: #F56C6C; }
  558. .category-icon.storage { background: #909399; }
  559. .category-icon.ai { background: #8E44AD; }
  560. .category-item h4 {
  561. font-size: 1.25rem;
  562. font-weight: 600;
  563. margin-bottom: 12px;
  564. color: #303133;
  565. }
  566. .category-item p {
  567. color: #606266;
  568. line-height: 1.5;
  569. }
  570. /* CTA区域 */
  571. .cta-section {
  572. padding: 80px 0;
  573. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  574. color: white;
  575. text-align: center;
  576. width: 100%;
  577. }
  578. .cta-content h2 {
  579. font-size: 2.5rem;
  580. font-weight: 700;
  581. margin-bottom: 16px;
  582. }
  583. .cta-content p {
  584. font-size: 1.2rem;
  585. margin-bottom: 32px;
  586. opacity: 0.9;
  587. }
  588. .cta-actions {
  589. display: flex;
  590. gap: 16px;
  591. justify-content: center;
  592. }
  593. /* 页脚 */
  594. .footer {
  595. background: #2c3e50;
  596. color: white;
  597. padding: 60px 0 20px;
  598. flex-shrink: 0; /* 防止页脚被压缩 */
  599. width: 100%;
  600. }
  601. .footer-content {
  602. display: grid;
  603. grid-template-columns: 2fr 1fr 1fr 1fr;
  604. gap: 40px;
  605. margin-bottom: 40px;
  606. }
  607. .footer-logo {
  608. display: flex;
  609. align-items: center;
  610. gap: 8px;
  611. font-size: 1.25rem;
  612. font-weight: 600;
  613. margin-bottom: 16px;
  614. }
  615. .footer-description {
  616. color: #bdc3c7;
  617. line-height: 1.6;
  618. }
  619. .footer-section h4 {
  620. margin-bottom: 20px;
  621. color: white;
  622. }
  623. .footer-section ul {
  624. list-style: none;
  625. padding: 0;
  626. }
  627. .footer-section li {
  628. margin-bottom: 12px;
  629. }
  630. .footer-section a {
  631. color: #bdc3c7;
  632. text-decoration: none;
  633. transition: color 0.3s;
  634. }
  635. .footer-section a:hover {
  636. color: white;
  637. }
  638. .footer-bottom {
  639. text-align: center;
  640. padding-top: 20px;
  641. border-top: 1px solid #34495e;
  642. color: #bdc3c7;
  643. }
  644. /* 响应式设计 */
  645. @media (max-width: 768px) {
  646. .hero-container {
  647. grid-template-columns: 1fr;
  648. text-align: center;
  649. gap: 40px;
  650. }
  651. .hero-title {
  652. font-size: 2.5rem;
  653. }
  654. .nav-menu {
  655. display: none;
  656. }
  657. .hero-stats {
  658. justify-content: center;
  659. flex-wrap: wrap;
  660. }
  661. .footer-content {
  662. grid-template-columns: 1fr;
  663. text-align: center;
  664. gap: 30px;
  665. }
  666. .cta-actions {
  667. flex-direction: column;
  668. align-items: center;
  669. }
  670. .features-grid,
  671. .categories-grid {
  672. grid-template-columns: 1fr;
  673. }
  674. }
  675. /* 确保所有元素宽度为100% */
  676. .home-page > * {
  677. width: 100%;
  678. }
  679. </style>