index.scss 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. @use 'sass:color';
  2. @use '@/styles/variables.scss' as *;
  3. // 导入全局样式变量
  4. // ===== AppCard 应用卡片样式 =====
  5. // 使用全局变量,符合设计规范 v3.0
  6. .app-card {
  7. background: $bg-secondary;
  8. border: 1px solid $border-base;
  9. border-radius: $radius-xl;
  10. padding: $spacing-4;
  11. cursor: pointer;
  12. transition: $transition-base;
  13. position: relative;
  14. overflow: hidden;
  15. min-height: 280px;
  16. display: flex;
  17. flex-direction: column;
  18. &:hover {
  19. transform: translateY(-$spacing-1);
  20. box-shadow: $shadow-lg;
  21. border-color: rgba(0, 93, 128, 0.3);
  22. .card-actions {
  23. opacity: 1;
  24. transform: translateY(0);
  25. }
  26. .card-hover-actions {
  27. opacity: 1;
  28. transform: translateY(0);
  29. }
  30. .card-title {
  31. color: $primary-color;
  32. }
  33. }
  34. }
  35. // 热门标识 - 缩小尺寸,被操作按钮遮盖
  36. .card-hot-badge {
  37. position: absolute;
  38. top: $spacing-3;
  39. right: $spacing-3;
  40. padding: $spacing-1 $spacing-2;
  41. background: linear-gradient(135deg, $warning-color 0%, color.adjust($warning-color, $lightness: -10%) 100%);
  42. color: $bg-secondary;
  43. border-radius: $radius-full;
  44. font-size: $font-xs;
  45. font-weight: $font-weight-bold;
  46. text-transform: uppercase;
  47. letter-spacing: 0.05em;
  48. box-shadow: 0 2px 8px rgba($warning-color, 0.3);
  49. z-index: 5;
  50. }
  51. // 状态标签
  52. .card-status-badge {
  53. position: absolute;
  54. top: $spacing-4;
  55. left: $spacing-4;
  56. padding: 2px 6px;
  57. color: $bg-secondary;
  58. border-radius: $radius-full;
  59. font-size: 9px;
  60. font-weight: $font-weight-semibold;
  61. z-index: 10;
  62. }
  63. // 卡片头部:图标 + 创建者
  64. .card-header {
  65. display: flex;
  66. justify-content: flex-start;
  67. align-items: flex-start;
  68. margin-bottom: $spacing-3;
  69. gap: $spacing-3;
  70. }
  71. // 创建者信息区域 - 三行文字与图标高度一致(56px)
  72. // 计算:$font-xs + $font-base + $font-sm = 9px + 13px + 12px = 34px 文字
  73. // + $spacing-1 × 2 = 8px 间距 + 行高余量 ≈ 56px
  74. .card-creator {
  75. display: flex;
  76. align-items: center;
  77. flex: 1;
  78. min-width: 0;
  79. .card-creator-info {
  80. display: flex;
  81. flex-direction: column;
  82. gap: $spacing-1; // 行间距 4px
  83. line-height: $line-height-tight;
  84. .card-creator-label {
  85. font-size: $font-xs; // 9px
  86. color: $text-hint;
  87. text-transform: uppercase;
  88. letter-spacing: 0.05em;
  89. font-weight: $font-weight-medium;
  90. line-height: $line-height-tight;
  91. }
  92. .card-creator-name {
  93. font-size: $font-base; // 13px
  94. color: $text-secondary;
  95. font-weight: $font-weight-semibold;
  96. white-space: nowrap;
  97. overflow: hidden;
  98. text-overflow: ellipsis;
  99. line-height: $line-height-tight;
  100. }
  101. // 项目名称 - 单行省略
  102. .card-pro-name {
  103. font-size: $font-sm; // 12px
  104. color: $text-hint;
  105. white-space: nowrap;
  106. overflow: hidden;
  107. text-overflow: ellipsis;
  108. max-width: 180px;
  109. line-height: $line-height-tight;
  110. }
  111. }
  112. }
  113. // 图标容器
  114. .card-icon-wrapper {
  115. width: $card-icon-size;
  116. height: $card-icon-size;
  117. border-radius: $radius-xl;
  118. display: flex;
  119. align-items: center;
  120. justify-content: center;
  121. padding: 2px;
  122. flex-shrink: 0;
  123. &.bg-blue { background: $icon-bg-blue; }
  124. &.bg-indigo { background: $icon-bg-indigo; }
  125. &.bg-teal { background: $icon-bg-teal; }
  126. &.bg-purple { background: $icon-bg-purple; }
  127. &.bg-rose { background: $icon-bg-rose; }
  128. &.bg-cyan { background: $icon-bg-cyan; }
  129. &.bg-amber { background: $icon-bg-amber; }
  130. &.bg-green { background: #F0FDF4; }
  131. &.bg-orange { background: #FFF7ED; }
  132. .card-icon,
  133. svg {
  134. width: 100%;
  135. height: 100%;
  136. object-fit: contain;
  137. // fill 风格图标 - 移除描边
  138. &[fill="none"] {
  139. fill: currentColor;
  140. stroke: none;
  141. }
  142. }
  143. }
  144. // 操作按钮 - 悬停显示(在 Hot Tag 上层,完全遮盖)
  145. .card-actions {
  146. position: absolute;
  147. top: $spacing-2;
  148. right: $spacing-2;
  149. display: flex;
  150. gap: $spacing-1;
  151. opacity: 0;
  152. transform: translateY(0);
  153. transition: $transition-base;
  154. z-index: 15;
  155. .card-action-btn {
  156. width: $card-btn-size;
  157. height: $card-btn-size;
  158. border-radius: $radius-lg;
  159. background: $bg-tertiary;
  160. border: none;
  161. display: flex;
  162. align-items: center;
  163. justify-content: center;
  164. color: $text-secondary;
  165. cursor: pointer;
  166. transition: $transition-base;
  167. &:hover {
  168. background: $border-base;
  169. color: $primary-color;
  170. transform: scale(1.05);
  171. }
  172. svg {
  173. width: 16px;
  174. height: 16px;
  175. }
  176. }
  177. }
  178. // 应用名称
  179. .card-title {
  180. font-size: $font-lg;
  181. font-weight: $font-weight-semibold;
  182. color: $text-primary;
  183. margin: 0;
  184. padding: 0;
  185. margin-bottom: $spacing-2;
  186. transition: $transition-fast;
  187. line-height: $line-height-tight;
  188. .app-card:hover & {
  189. color: $primary-color;
  190. }
  191. }
  192. // 应用描述
  193. .card-description {
  194. font-size: $font-sm;
  195. color: $text-secondary;
  196. line-height: $line-height-base;
  197. margin-bottom: $spacing-2;
  198. display: -webkit-box;
  199. -webkit-line-clamp: 2;
  200. -webkit-box-orient: vertical;
  201. overflow: hidden;
  202. min-height: 39px;
  203. }
  204. // 标签
  205. .card-tags {
  206. display: flex;
  207. flex-wrap: wrap;
  208. gap: $spacing-1;
  209. margin-bottom: $spacing-2;
  210. }
  211. .card-tag {
  212. padding: 3px 10px;
  213. border-radius: $radius-md;
  214. font-size: $font-xs;
  215. font-weight: $font-weight-bold;
  216. text-transform: uppercase;
  217. letter-spacing: 0.05em;
  218. white-space: nowrap;
  219. &.tag-slate { background: $tag-bg-slate; color: $tag-text-slate; }
  220. &.tag-blue { background: $tag-bg-blue; color: $tag-text-blue; }
  221. &.tag-indigo { background: $tag-bg-indigo; color: $tag-text-indigo; }
  222. &.tag-teal { background: $tag-bg-teal; color: $tag-text-teal; }
  223. &.tag-purple { background: $tag-bg-purple; color: $tag-text-purple; }
  224. &.tag-rose { background: $tag-bg-rose; color: $tag-text-rose; }
  225. &.tag-cyan { background: $tag-bg-cyan; color: $tag-text-cyan; }
  226. &.tag-amber { background: $tag-bg-amber; color: $tag-text-amber; }
  227. }
  228. // 统计信息
  229. .card-meta {
  230. display: flex;
  231. justify-content: space-between;
  232. align-items: center;
  233. margin-top: 0;
  234. .card-meta-left {
  235. display: flex;
  236. gap: $spacing-3;
  237. }
  238. .card-meta-right {
  239. margin-left: auto;
  240. }
  241. .card-meta-item {
  242. display: flex;
  243. align-items: center;
  244. gap: $spacing-1;
  245. font-size: $font-sm;
  246. color: $text-hint;
  247. svg {
  248. width: 14px;
  249. height: 14px;
  250. }
  251. }
  252. }
  253. // 底部信息
  254. .card-footer-info {
  255. display: flex;
  256. align-items: center;
  257. gap: $spacing-2;
  258. flex-wrap: wrap;
  259. padding-top: $spacing-2;
  260. margin-top: auto;
  261. }
  262. .card-certification {
  263. display: flex;
  264. align-items: center;
  265. gap: $spacing-1;
  266. font-size: $font-xs;
  267. color: $text-hint;
  268. svg {
  269. width: 14px;
  270. height: 14px;
  271. color: $success-color;
  272. }
  273. }
  274. .card-department {
  275. display: flex;
  276. align-items: center;
  277. gap: $spacing-1;
  278. font-size: $font-xs;
  279. color: $text-secondary;
  280. white-space: nowrap;
  281. overflow: hidden;
  282. text-overflow: ellipsis;
  283. max-width: 200px;
  284. svg {
  285. width: 14px;
  286. height: 14px;
  287. }
  288. }
  289. .card-visible-tag {
  290. font-size: $font-xs;
  291. font-weight: $font-weight-semibold;
  292. padding: 2px 8px;
  293. border-radius: $radius-sm;
  294. background: $bg-tertiary;
  295. }
  296. // 悬停操作按钮层
  297. .card-hover-actions {
  298. position: absolute;
  299. bottom: 0;
  300. left: 0;
  301. right: 0;
  302. display: flex;
  303. justify-content: space-between; // 两端对齐
  304. align-items: center;
  305. padding: $spacing-4;
  306. background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
  307. border-top: 1px solid $border-light;
  308. opacity: 0;
  309. transform: translateY($spacing-2);
  310. transition: $transition-base;
  311. pointer-events: none;
  312. .app-card:hover & {
  313. opacity: 1;
  314. transform: translateY(0);
  315. pointer-events: auto;
  316. }
  317. .card-operation-btn {
  318. flex: 0 0 auto; // 不伸缩
  319. width: auto;
  320. min-width: 100px;
  321. height: 40px;
  322. background: $bg-tertiary;
  323. border: 1px solid $border-base;
  324. border-radius: $radius-lg;
  325. font-size: $font-md;
  326. font-weight: $font-weight-medium;
  327. color: $text-primary;
  328. transition: $transition-base;
  329. margin-right: $spacing-2; // 与立即使用按钮的间距
  330. display: inline-flex;
  331. align-items: center;
  332. justify-content: center;
  333. &:hover {
  334. background: $border-base;
  335. border-color: $border-dark;
  336. color: $text-primary;
  337. }
  338. svg {
  339. width: 18px;
  340. height: 18px;
  341. }
  342. }
  343. .card-use-btn {
  344. flex: 0 0 auto; // 不伸缩
  345. width: auto;
  346. min-width: 120px;
  347. height: 40px;
  348. background: linear-gradient(135deg, $primary-color 0%, $primary-light 100%);
  349. border: none;
  350. border-radius: $radius-lg;
  351. font-size: $font-md;
  352. font-weight: $font-weight-semibold;
  353. color: $bg-secondary;
  354. box-shadow: 0 4px 12px rgba(0, 93, 128, 0.3);
  355. transition: $transition-base;
  356. display: inline-flex;
  357. align-items: center;
  358. justify-content: center;
  359. &:hover {
  360. background: linear-gradient(135deg, $primary-dark 0%, $primary-color 100%);
  361. box-shadow: 0 6px 16px rgba(0, 93, 128, 0.4);
  362. transform: translateY(-$spacing-1);
  363. }
  364. &:active {
  365. transform: translateY(0);
  366. box-shadow: 0 2px 8px rgba(0, 93, 128, 0.2);
  367. }
  368. svg {
  369. width: 18px;
  370. height: 18px;
  371. }
  372. }
  373. }
  374. // 注意:.app-card-grid 已在全局 global.less 中定义,此处不需要重复
  375. // ===== H5 移动端极简样式(v3.7 新增)=====
  376. // 仅在移动端(≤768px)生效,用于应用广场 2 列布局
  377. @media (max-width: 768px) {
  378. .mobile-app-card {
  379. min-height: auto;
  380. padding: 0;
  381. border-radius: var(--h5-radius-lg, $radius-xl);
  382. overflow: hidden;
  383. background: var(--h5-bg-secondary, $bg-secondary);
  384. border: 1px solid var(--h5-border, $border-base);
  385. // 隐藏所有复杂元素
  386. .card-creator,
  387. .card-pro-name,
  388. .card-description,
  389. .card-tags,
  390. .card-certification,
  391. .card-department,
  392. .card-meta,
  393. .card-actions,
  394. .card-hover-actions,
  395. .card-hot-badge,
  396. .card-status-badge {
  397. display: none;
  398. }
  399. // 图片区域(全宽)
  400. .card-icon-wrapper {
  401. width: 100%;
  402. height: auto;
  403. aspect-ratio: 1; // 正方形
  404. border-radius: $radius-xl;
  405. padding: 0;
  406. margin: 0;
  407. .card-icon,
  408. .iconify {
  409. width: 100%;
  410. height: 100%;
  411. object-fit: cover;
  412. }
  413. }
  414. // 头部区域
  415. .card-header {
  416. padding: var(--h5-spacing-md, $spacing-3);
  417. margin: 0;
  418. gap: var(--h5-spacing-sm, $spacing-2);
  419. }
  420. // 卡片标题
  421. .card-title {
  422. padding: 0 var(--h5-spacing-md, $spacing-3) var(--h5-spacing-md, $spacing-3);
  423. font-size: var(--h5-font-base, $font-lg);
  424. font-weight: var(--h5-font-weight-medium, $font-weight-medium);
  425. color: var(--h5-text-primary, $text-primary);
  426. margin: 0;
  427. overflow: hidden;
  428. text-overflow: ellipsis;
  429. white-space: nowrap;
  430. }
  431. // 悬停效果禁用(移动端无悬停)
  432. &:hover {
  433. transform: none;
  434. box-shadow: none;
  435. border-color: var(--h5-border, #E8E4DF);
  436. }
  437. // 点击反馈
  438. &:active {
  439. background: var(--h5-bg-tertiary, $bg-tertiary);
  440. }
  441. }
  442. }