header.scss 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. @use '@/styles/variables.scss' as *;
  2. // 导入全局样式变量
  3. .header {
  4. width: 100%;
  5. height: $header-height;
  6. padding: 0 $spacing-6;
  7. background: rgba($bg-secondary, 0.8);
  8. backdrop-filter: blur(12px);
  9. -webkit-backdrop-filter: blur(12px);
  10. display: flex;
  11. justify-content: space-between;
  12. align-items: center;
  13. border-bottom: 1px solid rgba($border-base, 0.5);
  14. box-shadow: $shadow-sm;
  15. position: fixed;
  16. top: 0;
  17. left: 0;
  18. z-index: $z-index-fixed;
  19. transition: $transition-base;
  20. &.scrolled {
  21. background: $bg-secondary;
  22. box-shadow: $shadow-md;
  23. }
  24. // 汉堡菜单按钮(移动端)
  25. .mobile-menu-btn {
  26. display: none; // 默认隐藏
  27. font-size: 20px;
  28. color: $text-primary;
  29. margin-right: $spacing-2;
  30. padding: $spacing-2;
  31. border: none;
  32. background: transparent;
  33. cursor: pointer;
  34. transition: all 0.2s ease;
  35. &:hover {
  36. background: $bg-tertiary;
  37. border-radius: $radius-md;
  38. }
  39. @media (max-width: 768px) {
  40. display: block; // 移动端显示
  41. }
  42. }
  43. &-container {
  44. display: flex;
  45. align-items: center;
  46. justify-content: space-between; // 两端对齐
  47. width: 100%; // 占满宽度
  48. gap: $spacing-6;
  49. }
  50. // Logo 区域 + 智能问答 wrapper
  51. &-logo-wrapper {
  52. display: flex;
  53. align-items: center;
  54. gap: $spacing-5;
  55. flex-shrink: 0;
  56. }
  57. // Logo 区域
  58. &-logo-section {
  59. display: flex;
  60. align-items: center;
  61. cursor: pointer;
  62. gap: $spacing-3;
  63. min-width: 240px; // 桌面端最小宽度
  64. flex-shrink: 0; // 不允许收缩
  65. transition: $transition-base;
  66. &:hover {
  67. transform: translateX($spacing-1);
  68. }
  69. .logo-image {
  70. height: $spacing-9; // 固定高度
  71. width: auto; // 宽度自适应
  72. object-fit: contain;
  73. flex-shrink: 0;
  74. }
  75. // Logo 图形与文字之间的竖线间隔
  76. .logo-divider {
  77. width: 1px;
  78. height: $font-xl;
  79. background: $border-base; // 浅灰色
  80. flex-shrink: 0;
  81. }
  82. .logo-text-section {
  83. display: flex;
  84. flex-direction: column;
  85. gap: $spacing-1;
  86. .logo-title {
  87. font-size: $font-xl;
  88. font-weight: $font-weight-bold;
  89. color: $text-primary;
  90. margin: 0;
  91. white-space: nowrap; // 不换行
  92. }
  93. .logo-subtitle {
  94. font-size: 10px; // 副标题字体减小
  95. font-weight: $font-weight-semibold;
  96. color: $primary-light;
  97. text-transform: uppercase;
  98. letter-spacing: 0.1em;
  99. margin: 0;
  100. }
  101. }
  102. }
  103. // 平板端(≤1024px)样式调整
  104. @media (max-width: $screen-lg) {
  105. &-logo-section {
  106. min-width: 180px; // 平板端最小宽度减小
  107. .logo-image {
  108. height: $font-xl; // 平板端保持
  109. }
  110. }
  111. // 平板端隐藏智能问答按钮
  112. .quick-access-btn {
  113. display: none;
  114. }
  115. }
  116. // 移动端(≤768px)样式调整
  117. @media (max-width: $screen-md) {
  118. &-logo-section {
  119. min-width: 140px; // 移动端最小宽度更小
  120. .logo-image {
  121. height: $spacing-8; // 移动端稍微减小
  122. }
  123. .logo-title {
  124. font-size: $font-lg; // 标题字体减小
  125. }
  126. .logo-subtitle {
  127. font-size: 10px; // 副标题字体减小
  128. }
  129. }
  130. }
  131. // 右侧功能区
  132. &-right {
  133. display: flex;
  134. align-items: center;
  135. gap: $spacing-5;
  136. margin-left: auto;
  137. }
  138. // 搜索框 - 已注释
  139. // .header-search {
  140. // position: relative;
  141. // width: 400px;
  142. // max-width: 100%;
  143. // .search-icon {
  144. // position: absolute;
  145. // left: 16px;
  146. // top: 50%;
  147. // transform: translateY(-50%);
  148. // font-size: 20px;
  149. // color: $text-hint;
  150. // pointer-events: none;
  151. // }
  152. // .search-input {
  153. // width: 100%;
  154. // height: 40px;
  155. // padding: 0 16px 0 48px;
  156. // background: rgba($bg-tertiary, 0.8);
  157. // border: 1px solid transparent;
  158. // border-radius: 8px;
  159. // font-size: 14px;
  160. // color: $text-primary;
  161. // outline: none;
  162. // transition: all 0.2s ease;
  163. // &::placeholder {
  164. // color: #9CA3AF;
  165. // }
  166. // &:focus {
  167. // background: rgba(255, 255, 255, 1);
  168. // border-color: #3B82F6;
  169. // box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  170. // }
  171. // &:hover {
  172. // background: $bg-secondary;
  173. // }
  174. // }
  175. // }
  176. // 安全状态指示器
  177. .security-status {
  178. display: flex;
  179. align-items: center;
  180. gap: $spacing-1;
  181. padding: $spacing-2 $spacing-3;
  182. background: rgba($bg-tertiary, 0.8);
  183. border-radius: $radius-full;
  184. font-size: 12px;
  185. color: $text-hint;
  186. font-weight: 500;
  187. cursor: default;
  188. transition: all 0.2s ease;
  189. &:hover {
  190. background: rgba($bg-tertiary, 1);
  191. }
  192. .status-dot {
  193. width: 8px;
  194. height: 8px;
  195. border-radius: 50%;
  196. background: $success-color;
  197. animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  198. }
  199. }
  200. // 智能问答快捷入口
  201. .quick-access-btn {
  202. display: flex;
  203. align-items: center;
  204. gap: $spacing-1;
  205. padding: $spacing-2 $spacing-3;
  206. background: linear-gradient(135deg, $primary-light 0%, $primary-color 100%); // 企业 Logo 蓝色渐变
  207. border: none;
  208. border-radius: 9999px;
  209. font-size: 13px;
  210. font-weight: 600;
  211. color: $bg-secondary;
  212. cursor: pointer;
  213. transition: all 0.2s ease;
  214. box-shadow: 0 2px 8px rgba(0, 160, 202, 0.3);
  215. &:hover {
  216. transform: translateY(-2px);
  217. box-shadow: 0 4px 12px rgba(0, 160, 202, 0.4);
  218. }
  219. &:active {
  220. transform: translateY(0);
  221. }
  222. .iconify, .anticon {
  223. font-size: 16px;
  224. }
  225. }
  226. // 通知按钮
  227. .notification-btn {
  228. width: $card-btn-size;
  229. height: $card-btn-size;
  230. border-radius: $radius-lg;
  231. display: flex;
  232. align-items: center;
  233. justify-content: center;
  234. color: $text-hint;
  235. background: transparent;
  236. border: none;
  237. cursor: pointer;
  238. transition: all 0.2s ease;
  239. position: relative;
  240. &:hover {
  241. background: $bg-tertiary;
  242. color: $primary-color;
  243. }
  244. .iconify {
  245. font-size: 24px;
  246. }
  247. .notification-dot {
  248. position: absolute;
  249. top: 8px;
  250. right: 8px;
  251. width: 10px;
  252. height: 10px;
  253. background: $error-color;
  254. border-radius: 50%;
  255. border: 2px solid $bg-secondary;
  256. animation: bounce 1s infinite;
  257. }
  258. }
  259. // 用户下拉菜单
  260. .user-dropdown-wrapper {
  261. position: relative;
  262. }
  263. .user-section {
  264. display: flex;
  265. align-items: center;
  266. gap: $spacing-2;
  267. padding: $spacing-2 $spacing-3;
  268. border-radius: 8px;
  269. cursor: pointer;
  270. transition: all 0.2s ease;
  271. background: transparent;
  272. border: none;
  273. &:hover {
  274. background: $bg-tertiary;
  275. }
  276. .user-avatar {
  277. width: 36px;
  278. height: 36px;
  279. border-radius: 50%;
  280. background: $bg-secondary;
  281. border: 2px solid transparent;
  282. overflow: hidden;
  283. transition: all 0.2s ease;
  284. img {
  285. width: 100%;
  286. height: 100%;
  287. object-fit: cover;
  288. }
  289. }
  290. &:hover .user-avatar {
  291. border-color: $primary-color;
  292. }
  293. .user-info {
  294. display: flex;
  295. flex-direction: column;
  296. gap: $spacing-1;
  297. text-align: left;
  298. min-width: 80px;
  299. .user-name {
  300. font-size: $font-md;
  301. font-weight: $font-semibold;
  302. color: $text-primary;
  303. transition: color 0.2s ease;
  304. white-space: nowrap;
  305. }
  306. &:hover .user-name {
  307. color: $primary-color;
  308. }
  309. .user-dept {
  310. font-size: $font-xs;
  311. color: $text-hint;
  312. white-space: nowrap;
  313. }
  314. }
  315. .user-dropdown-icon {
  316. font-size: $icon-md;
  317. color: $text-hint;
  318. transition: color 0.2s ease;
  319. }
  320. }
  321. .user-dropdown-menu {
  322. position: absolute;
  323. top: calc(100% + $spacing-2);
  324. right: 0;
  325. min-width: 200px;
  326. background: $bg-secondary;
  327. border-radius: $radius-xl; // 12px
  328. box-shadow: $shadow-xl;
  329. border: 1px solid $border-base;
  330. padding: $spacing-2;
  331. z-index: $z-index-dropdown;
  332. animation: dropdownSlide 0.2s ease;
  333. .user-dropdown-header {
  334. padding: $spacing-3 $spacing-4;
  335. border-bottom: 1px solid $border-light;
  336. margin-bottom: $spacing-2;
  337. .user-dropdown-name {
  338. font-size: $font-md;
  339. font-weight: $font-weight-semibold;
  340. color: $text-primary;
  341. margin-bottom: 4px;
  342. }
  343. .user-dropdown-dept {
  344. font-size: $font-xs;
  345. color: $text-hint;
  346. }
  347. }
  348. .user-dropdown-item {
  349. display: flex;
  350. align-items: center;
  351. gap: $spacing-2;
  352. padding: $spacing-2 $spacing-3;
  353. border-radius: $radius-md;
  354. width: 100%;
  355. background: transparent;
  356. border: none;
  357. cursor: pointer;
  358. transition: all 0.2s ease;
  359. text-align: left;
  360. font-size: $font-md;
  361. color: $text-primary;
  362. &:hover {
  363. background: $bg-tertiary;
  364. color: $primary-color;
  365. .iconify {
  366. color: $primary-color;
  367. }
  368. }
  369. &.danger {
  370. color: $error-color;
  371. &:hover {
  372. background: rgba($error-color, 0.1);
  373. }
  374. .iconify {
  375. color: $error-color;
  376. }
  377. }
  378. &.divider {
  379. height: 1px;
  380. background: $border-base;
  381. margin: 8px 0;
  382. padding: 0;
  383. cursor: default;
  384. &:hover {
  385. background: $border-base;
  386. }
  387. }
  388. .iconify {
  389. font-size: $icon-md;
  390. color: $text-hint;
  391. transition: color 0.2s ease;
  392. }
  393. }
  394. }
  395. }
  396. // 动画
  397. @keyframes pulse {
  398. 0%, 100% { opacity: 1; }
  399. 50% { opacity: 0.5; }
  400. }
  401. @keyframes bounce {
  402. 0%, 100% { transform: scale(1); }
  403. 50% { transform: scale(1.1); }
  404. }
  405. @keyframes dropdownSlide {
  406. from {
  407. opacity: 0;
  408. transform: translateY(-10px);
  409. }
  410. to {
  411. opacity: 1;
  412. transform: translateY(0);
  413. }
  414. }
  415. // 响应式
  416. @media (max-width: 1024px) {
  417. .header {
  418. padding: 0 16px;
  419. .user-info {
  420. display: none;
  421. }
  422. }
  423. }
  424. @media (max-width: 768px) {
  425. .header {
  426. padding: 0 12px;
  427. .security-status span {
  428. display: none;
  429. }
  430. .notification-btn {
  431. width: 36px;
  432. height: 36px;
  433. }
  434. .user-avatar {
  435. width: 32px;
  436. height: 32px;
  437. }
  438. }
  439. }