navigation.scss 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. // navigation.scss:手机端导航组件样式文件,实现符合大厂UI规范的设计
  2. @use 'sass:math';
  3. @use 'sass:color';
  4. // 定义颜色变量(符合大厂UI规范)
  5. $primary-color: #1890FF; // 主色
  6. $success-color: #52C41A; // 成功色
  7. $warning-color: #FAAD14; // 警告色
  8. $error-color: #F5222D; // 错误色
  9. $text-primary: #1D1D1F; // 主文本色
  10. $text-secondary: #8E8E93; // 次文本色
  11. $bg-page: #F8F8F8; // 页面背景色
  12. $bg-card: #FFFFFF; // 卡片背景色
  13. $border-color: #EEEEEE; // 边框色
  14. $shadow-color: rgba(0, 0, 0, 0.1); // 阴影色
  15. // 定义尺寸变量(基于vw单位,适配移动端)
  16. $space-xs: 1.07vw; // 4px
  17. $space-s: 2.13vw; // 8px
  18. $space-m: 4.27vw; // 16px
  19. $space-l: 6.4vw; // 24px
  20. $space-xl: 8.53vw; // 32px
  21. $font-title: 5.33vw; // 20px
  22. $font-subtitle: 4.27vw; // 16px
  23. $font-body: 3.73vw; // 14px
  24. $font-caption: 3.2vw; // 12px
  25. $border-radius-small: 1.07vw; // 4px
  26. $border-radius-medium: 2.13vw; // 8px
  27. $border-radius-large: 3.2vw; // 12px
  28. // 基础容器样式
  29. .navigation-container {
  30. position: relative;
  31. width: 100%;
  32. height: 100vh;
  33. background-color: $bg-page;
  34. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  35. overflow: hidden;
  36. }
  37. // 地图区域样式
  38. .map-area {
  39. position: absolute;
  40. top: 0;
  41. left: 0;
  42. width: 100%;
  43. height: 100%;
  44. z-index: 1;
  45. }
  46. .map-content {
  47. position: relative;
  48. width: 100%;
  49. height: 100%;
  50. }
  51. // 地图容器
  52. #amap-container {
  53. width: 100%;
  54. height: 100%;
  55. }
  56. // 输入框容器样式(两种状态)
  57. .input-container {
  58. position: absolute;
  59. left: 4.27vw; // 16px
  60. right: 4.27vw; // 16px
  61. background-color: $bg-card;
  62. border-radius: $border-radius-medium;
  63. box-shadow: 0 0.53vw 2.13vw $shadow-color; // 2px 8px
  64. z-index: 10;
  65. transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  66. display: flex;
  67. align-items: center;
  68. padding: 0 $space-s;
  69. height: 12.8vw; // 48px
  70. opacity: 0;
  71. visibility: hidden;
  72. &.visible {
  73. opacity: 1;
  74. visibility: visible;
  75. }
  76. // 顶部状态
  77. &.top-state {
  78. top: $space-m; // 16px
  79. }
  80. // 底部状态
  81. &.bottom-state {
  82. bottom: $space-m; // 16px
  83. }
  84. }
  85. // 底部控件容器
  86. .bottom-controls {
  87. position: absolute;
  88. bottom: $space-m; // 16px
  89. left: 0;
  90. right: 0;
  91. display: flex;
  92. flex-direction: column;
  93. align-items: center;
  94. gap: $space-m; // 16px
  95. z-index: 10;
  96. }
  97. // 底部按钮区域
  98. .bottom-button-area {
  99. position: absolute;
  100. bottom: 0;
  101. width: 100%;
  102. padding: $space-m;
  103. text-align: center;
  104. background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 100%);
  105. display: flex;
  106. justify-content: center;
  107. gap: $space-m; // 16px
  108. z-index: 90;
  109. }
  110. // 路线按钮样式
  111. .route-button {
  112. width: 85%;
  113. height: 12.8vw; // 48px
  114. background-color: $primary-color; // 使用主色调
  115. border: none;
  116. border-radius: $border-radius-medium;
  117. color: white;
  118. font-size: $font-subtitle; // 16px
  119. display: flex;
  120. align-items: center;
  121. justify-content: center;
  122. gap: $space-s; // 8px
  123. cursor: pointer;
  124. box-shadow: 0 0.53vw 2.13vw rgba(24, 144, 255, 0.4); // 主色阴影
  125. opacity: 0;
  126. visibility: hidden;
  127. transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  128. padding: 0;
  129. &.visible {
  130. opacity: 1;
  131. visibility: visible;
  132. }
  133. &:active {
  134. background-color: color.mix($primary-color, #000, 90%); // 按下时颜色变深,使用新的color.mix()函数
  135. transform: scale(0.98);
  136. }
  137. i {
  138. color: white;
  139. }
  140. span {
  141. font-weight: 500;
  142. }
  143. }
  144. // 路线按钮样式(底部按钮区)
  145. .route-btn {
  146. background-color: $primary-color; // 使用主色调
  147. color: white;
  148. border: none;
  149. border-radius: $border-radius-medium;
  150. padding: $space-s $space-xl;
  151. font-size: $font-subtitle; // 16px
  152. cursor: pointer;
  153. box-shadow: 0 0.53vw 2.13vw rgba(24, 144, 255, 0.4); // 主色阴影
  154. transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  155. flex: 1;
  156. max-width: 180px;
  157. &:active {
  158. background-color: color.mix($primary-color, #000, 90%); // 按下时颜色变深,使用新的color.mix()函数
  159. transform: scale(0.98);
  160. }
  161. }
  162. // 导航按钮样式
  163. .navigate-btn {
  164. background-color: $success-color; // 使用成功色
  165. color: white;
  166. border: none;
  167. border-radius: $border-radius-medium;
  168. padding: $space-s $space-xl;
  169. font-size: $font-subtitle; // 16px
  170. cursor: pointer;
  171. box-shadow: 0 0.53vw 2.13vw rgba(82, 196, 26, 0.4); // 成功色阴影
  172. transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  173. flex: 1;
  174. max-width: 180px;
  175. &:active {
  176. background-color: color.mix($success-color, #000, 90%); // 按下时颜色变深,使用新的color.mix()函数
  177. transform: scale(0.98);
  178. }
  179. }
  180. // 路线规划面板
  181. .route-panel {
  182. position: absolute;
  183. top: 0;
  184. left: 0;
  185. right: 0;
  186. z-index: 110;
  187. background-color: rgba(255, 255, 255, 0.95);
  188. box-shadow: 0 1.07vw 4.27vw rgba(0, 0, 0, 0.15); // 4px 16px
  189. animation: slideDown 0.3s ease;
  190. }
  191. // 路线类型选择器
  192. .route-type-selector {
  193. display: flex;
  194. justify-content: center;
  195. padding: $space-m 0;
  196. border-bottom: 0.27vw solid $border-color; // 1px
  197. background-color: $bg-card;
  198. }
  199. // 路线类型按钮
  200. .route-type-btn {
  201. display: flex;
  202. flex-direction: column;
  203. align-items: center;
  204. justify-content: center;
  205. padding: $space-s $space-l;
  206. margin: 0 $space-s;
  207. background-color: transparent;
  208. border: none;
  209. cursor: pointer;
  210. transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  211. color: $text-secondary;
  212. font-size: $font-body; // 14px
  213. position: relative;
  214. &:active {
  215. color: $primary-color;
  216. }
  217. &.active {
  218. color: $primary-color;
  219. }
  220. &.active::after {
  221. content: '';
  222. position: absolute;
  223. bottom: 0;
  224. left: 20%;
  225. right: 20%;
  226. height: 0.53vw; // 2px
  227. background-color: $primary-color;
  228. border-radius: 0.27vw;
  229. }
  230. }
  231. // 图标样式 - 可以使用字体图标或SVG图标
  232. .route-type-btn i {
  233. font-size: 5.33vw; // 20px
  234. margin-bottom: $space-xs;
  235. display: block;
  236. }
  237. // 路线结果面板
  238. .route-result-panel {
  239. max-height: 60vh;
  240. overflow-y: auto;
  241. background-color: $bg-card;
  242. // 高德地图API会自动填充内容
  243. }
  244. // 动画效果
  245. @keyframes slideDown {
  246. from {
  247. transform: translateY(-100%);
  248. opacity: 0;
  249. }
  250. to {
  251. transform: translateY(0);
  252. opacity: 1;
  253. }
  254. }
  255. // 搜索提示结果区域
  256. .suggestion-panel {
  257. position: absolute;
  258. top: 19.2vw; // 顶部输入框下方
  259. left: 4.27vw; // 与输入框对齐
  260. right: 4.27vw;
  261. background-color: $bg-card;
  262. border-radius: $border-radius-medium;
  263. box-shadow: 0 1.07vw 4.27vw rgba(0, 0, 0, 0.15); // 4px 16px
  264. z-index: 20;
  265. max-height: 50vh;
  266. overflow-y: auto;
  267. opacity: 0;
  268. visibility: hidden;
  269. transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  270. &.visible {
  271. opacity: 1;
  272. visibility: visible;
  273. }
  274. }
  275. .suggestion-list {
  276. padding: $space-xs 0;
  277. }
  278. .suggestion-item {
  279. display: flex;
  280. align-items: flex-start;
  281. padding: $space-m;
  282. cursor: pointer;
  283. transition: background-color 0.2s;
  284. &:active {
  285. background-color: $bg-page;
  286. }
  287. }
  288. .suggestion-icon {
  289. margin-right: $space-s;
  290. margin-top: $space-xs;
  291. }
  292. .suggestion-content {
  293. flex: 1;
  294. overflow: hidden;
  295. }
  296. .suggestion-name {
  297. font-size: $font-subtitle; // 16px
  298. color: $text-primary;
  299. margin-bottom: $space-xs;
  300. overflow: hidden;
  301. text-overflow: ellipsis;
  302. white-space: nowrap;
  303. }
  304. .suggestion-address {
  305. font-size: $font-caption; // 12px
  306. color: $text-secondary;
  307. overflow: hidden;
  308. text-overflow: ellipsis;
  309. white-space: nowrap;
  310. }
  311. // 导航按钮样式
  312. .nav-button {
  313. height: 11.73vw; // 44px
  314. min-width: 11.73vw;
  315. min-height: 11.73vw;
  316. border-radius: 50%;
  317. background-color: rgba($bg-card, 0.9);
  318. border: none;
  319. box-shadow: 0 0.53vw 2.13vw rgba(0, 0, 0, 0.15); // 2px 8px
  320. display: flex;
  321. align-items: center;
  322. justify-content: center;
  323. cursor: pointer;
  324. padding: 0;
  325. &:active {
  326. background-color: rgba($bg-card, 0.7);
  327. }
  328. }
  329. // 图标样式
  330. .icon-back,
  331. .icon-search,
  332. .icon-history,
  333. .icon-location,
  334. .icon-poi {
  335. &::before {
  336. content: "";
  337. display: block;
  338. width: 5.33vw; // 20px
  339. height: 5.33vw; // 20px
  340. background-color: $text-primary;
  341. mask-size: contain;
  342. mask-repeat: no-repeat;
  343. mask-position: center;
  344. }
  345. }
  346. .icon-back::before {
  347. mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z'/%3E%3C/svg%3E");
  348. }
  349. .icon-search::before {
  350. mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E");
  351. }
  352. .icon-history::before {
  353. mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06C6.83 3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.46 7.48-3.77 7.94-7.94H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z'/%3E%3C/svg%3E");
  354. }
  355. .icon-location::before {
  356. mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/%3E%3C/svg%3E");
  357. }
  358. .icon-poi::before {
  359. mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/%3E%3C/svg%3E");
  360. background-color: $primary-color;
  361. }
  362. // 路线图标样式
  363. .icon-route::before {
  364. mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z'/%3E%3C/svg%3E");
  365. }
  366. // 输入框样式
  367. .location-input {
  368. flex: 1;
  369. border: none;
  370. font-size: $font-subtitle; // 16px
  371. color: $text-primary;
  372. background: transparent;
  373. box-sizing: border-box;
  374. padding: $space-xs $space-s;
  375. margin: 0 $space-s;
  376. &:focus {
  377. outline: none;
  378. }
  379. &::placeholder {
  380. color: $text-secondary;
  381. }
  382. }
  383. // 历史记录面板
  384. .history-panel {
  385. position: absolute;
  386. top: 21.33vw; // 80px (顶部输入框高度 + 间距)
  387. left: 0;
  388. right: 0;
  389. bottom: 0;
  390. background-color: $bg-card;
  391. z-index: 5;
  392. transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  393. opacity: 0;
  394. visibility: hidden;
  395. overflow-y: auto;
  396. &.visible {
  397. opacity: 1;
  398. visibility: visible;
  399. }
  400. }
  401. // 区域头部样式
  402. .section-header {
  403. padding: $space-m;
  404. border-bottom: 0.27vw solid $border-color; // 1px
  405. h3 {
  406. margin: 0;
  407. font-size: $font-subtitle; // 16px
  408. color: $text-primary;
  409. font-weight: 500;
  410. }
  411. }
  412. // 搜索结果区域
  413. .search-results-section {
  414. margin-bottom: $space-m;
  415. }
  416. .search-results-list {
  417. padding: $space-s 0;
  418. }
  419. .search-result-item {
  420. display: flex;
  421. align-items: flex-start;
  422. padding: $space-m;
  423. cursor: pointer;
  424. transition: background-color 0.2s;
  425. &:active {
  426. background-color: $bg-page;
  427. }
  428. }
  429. .result-icon {
  430. margin-right: $space-s;
  431. margin-top: $space-xs;
  432. }
  433. .result-content {
  434. flex: 1;
  435. overflow: hidden;
  436. }
  437. .result-name-row {
  438. display: flex;
  439. align-items: center;
  440. justify-content: space-between;
  441. margin-bottom: $space-xs;
  442. }
  443. .result-name {
  444. font-size: $font-subtitle; // 16px
  445. color: $text-primary;
  446. overflow: hidden;
  447. text-overflow: ellipsis;
  448. white-space: nowrap;
  449. flex: 1;
  450. margin-right: $space-s;
  451. }
  452. .result-distance {
  453. font-size: $font-caption; // 12px
  454. color: $primary-color;
  455. font-weight: 500;
  456. white-space: nowrap;
  457. min-width: 60px;
  458. text-align: right;
  459. }
  460. .result-address {
  461. font-size: $font-caption; // 12px
  462. color: $text-secondary;
  463. overflow: hidden;
  464. text-overflow: ellipsis;
  465. white-space: nowrap;
  466. }
  467. .no-results {
  468. padding: $space-l $space-m;
  469. text-align: center;
  470. color: $text-secondary;
  471. font-size: $font-body;
  472. }
  473. // 历史记录区域
  474. .history-section {
  475. border-top: 0.27vw solid $border-color; // 1px
  476. }
  477. .history-list {
  478. padding: $space-s 0;
  479. }
  480. .history-item {
  481. display: flex;
  482. align-items: center;
  483. padding: $space-s $space-m;
  484. &:active {
  485. background-color: $bg-page;
  486. }
  487. }
  488. .history-text {
  489. font-size: $font-body; // 14px
  490. color: $text-primary;
  491. }
  492. // 响应式设计(针对不同屏幕尺寸优化)
  493. @media (max-width: 768px) {
  494. // 在小屏幕上增加内边距
  495. .input-container {
  496. left: 2.13vw; // 8px
  497. right: 2.13vw; // 8px
  498. }
  499. // 调整搜索提示面板位置
  500. .suggestion-panel {
  501. left: 2.13vw;
  502. right: 2.13vw;
  503. top: 19.2vw;
  504. }
  505. // 调整历史记录面板的顶部位置
  506. .history-panel {
  507. top: 19.2vw; // 72px
  508. }
  509. }
  510. // 针对大屏幕设备的优化
  511. @media (min-width: 1024px) {
  512. .input-container {
  513. max-width: 500px;
  514. left: 50%;
  515. right: auto;
  516. transform: translateX(-50%);
  517. }
  518. // 搜索提示面板居中
  519. .suggestion-panel {
  520. max-width: 500px;
  521. left: 50%;
  522. right: auto;
  523. transform: translateX(-50%);
  524. }
  525. }