wuxing-sandbox.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. <template>
  2. <view class="wuxing-sandbox">
  3. <view class="sandbox-header">
  4. <text class="sandbox-title">🌟 五行能量沙盘</text>
  5. <text class="sandbox-badge">{{ badgeText }}</text>
  6. </view>
  7. <view class="sandbox-star">
  8. <!-- ===== 背景光晕 ===== -->
  9. <view class="star-glow-bg"></view>
  10. <!-- ===== 五角星轮廓(clip-path) ===== -->
  11. <view class="star-shape">
  12. <view class="star-shape__fill"></view>
  13. <view class="star-shape__outline"></view>
  14. </view>
  15. <!-- ===== 五角星连线(内五边形) ===== -->
  16. <view class="pentagram-lines">
  17. <view class="p-line p-line--1"></view>
  18. <view class="p-line p-line--2"></view>
  19. <view class="p-line p-line--3"></view>
  20. <view class="p-line p-line--4"></view>
  21. <view class="p-line p-line--5"></view>
  22. </view>
  23. <!-- ===== 顶点 1:心·火(上) ===== -->
  24. <view class="star-point star-point--top" @click="onPointClick('mind')" hover-class="point-hover">
  25. <view class="point-glow point-glow--fire"></view>
  26. <view class="point-dot point-dot--fire">
  27. <text class="point-icon">🔥</text>
  28. </view>
  29. <text class="point-label">心·火</text>
  30. <text class="point-status" v-if="mode === 'preview'">点此登录</text>
  31. </view>
  32. <!-- ===== 顶点 2:富·水(右上) ===== -->
  33. <view class="star-point star-point--ur" @click="onPointClick('wealth')" hover-class="point-hover">
  34. <view class="point-glow point-glow--water"></view>
  35. <view class="point-dot point-dot--water">
  36. <text class="point-icon">💧</text>
  37. </view>
  38. <text class="point-label">富·水</text>
  39. <text class="point-status" v-if="mode === 'preview'">点此登录</text>
  40. </view>
  41. <!-- ===== 顶点 3:身·土(右下) ===== -->
  42. <view class="star-point star-point--lr" @click="onPointClick('body')" hover-class="point-hover">
  43. <view class="point-glow point-glow--earth"></view>
  44. <view class="point-dot point-dot--earth">
  45. <text class="point-icon">🌏</text>
  46. </view>
  47. <text class="point-label">身·土</text>
  48. <text class="point-status" v-if="mode === 'preview'">点此登录</text>
  49. </view>
  50. <!-- ===== 顶点 4:智·金(左下) ===== -->
  51. <view class="star-point star-point--ll" @click="onPointClick('wisdom')" hover-class="point-hover">
  52. <view class="point-glow point-glow--metal"></view>
  53. <view class="point-dot point-dot--metal">
  54. <text class="point-icon">⚔️</text>
  55. </view>
  56. <text class="point-label">智·金</text>
  57. <text class="point-status" v-if="mode === 'preview'">点此登录</text>
  58. </view>
  59. <!-- ===== 顶点 5:行·木(左上) ===== -->
  60. <view class="star-point star-point--ul" @click="onPointClick('action')" hover-class="point-hover">
  61. <view class="point-glow point-glow--wood"></view>
  62. <view class="point-dot point-dot--wood">
  63. <text class="point-icon">🌿</text>
  64. </view>
  65. <text class="point-label">行·木</text>
  66. <text class="point-status" v-if="mode === 'preview'">点此登录</text>
  67. </view>
  68. <!-- ===== 中心 ===== -->
  69. <view class="star-center">
  70. <view class="center-icon-wrap">
  71. <text class="center-icon">☯</text>
  72. </view>
  73. <text class="center-text">五行平衡</text>
  74. <text class="center-sub">共同成长</text>
  75. </view>
  76. </view>
  77. <view class="shenke-hint" v-if="mode === 'preview'">
  78. <text class="hint-text">🌱 完成测评,点亮「身·土」</text>
  79. </view>
  80. <view class="dimension-bar" v-if="mode !== 'preview'">
  81. <view class="dim-item dim-item--wood">🌿行</view>
  82. <text class="dim-arrow">→</text>
  83. <view class="dim-item dim-item--fire">🔥心</view>
  84. <text class="dim-arrow">→</text>
  85. <view class="dim-item dim-item--earth">🌏身</view>
  86. <text class="dim-arrow">→</text>
  87. <view class="dim-item dim-item--metal">⚔️智</view>
  88. <text class="dim-arrow">→</text>
  89. <view class="dim-item dim-item--water">💧富</view>
  90. </view>
  91. </view>
  92. </template>
  93. <script>
  94. export default {
  95. props: {
  96. mode: { type: String, default: 'preview' },
  97. badgeText: { type: String, default: '综合成长力 0%' }
  98. },
  99. methods: {
  100. onPointClick(domain) {
  101. this.$emit('point-click', domain)
  102. }
  103. }
  104. }
  105. </script>
  106. <style scoped>
  107. /* ============================================================
  108. 容器 — 暗色渐变背景
  109. ============================================================ */
  110. .wuxing-sandbox {
  111. margin: 20rpx 30rpx;
  112. padding: 24rpx 24rpx 20rpx;
  113. background: linear-gradient(135deg, #0f0f23, #1a1a3e, #16213e);
  114. border-radius: 28rpx;
  115. position: relative;
  116. overflow: hidden;
  117. }
  118. .wuxing-sandbox::before {
  119. content: '';
  120. position: absolute;
  121. top: -50%;
  122. left: -50%;
  123. width: 200%;
  124. height: 200%;
  125. background: radial-gradient(ellipse at 30% 20%, rgba(255, 215, 0, 0.03), transparent 60%),
  126. radial-gradient(ellipse at 70% 80%, rgba(66, 165, 245, 0.03), transparent 60%);
  127. pointer-events: none;
  128. }
  129. /* ============================================================
  130. 标题栏
  131. ============================================================ */
  132. .sandbox-header {
  133. display: flex;
  134. justify-content: space-between;
  135. align-items: center;
  136. margin-bottom: 20rpx;
  137. position: relative;
  138. z-index: 2;
  139. }
  140. .sandbox-title {
  141. font-size: 28rpx;
  142. font-weight: bold;
  143. color: #FFD700;
  144. }
  145. .sandbox-badge {
  146. font-size: 20rpx;
  147. color: rgba(255, 215, 0, 0.7);
  148. background: rgba(255, 215, 0, 0.1);
  149. padding: 4rpx 14rpx;
  150. border-radius: 20rpx;
  151. }
  152. /* ============================================================
  153. 五角星区域
  154. ============================================================ */
  155. .sandbox-star {
  156. position: relative;
  157. height: 460rpx;
  158. display: flex;
  159. justify-content: center;
  160. align-items: center;
  161. }
  162. /* ---- 背景光晕 ---- */
  163. .star-glow-bg {
  164. position: absolute;
  165. width: 360rpx;
  166. height: 360rpx;
  167. top: 50%;
  168. left: 50%;
  169. transform: translate(-50%, -50%);
  170. background: radial-gradient(circle, rgba(255, 215, 0, 0.08), transparent 70%);
  171. border-radius: 50%;
  172. pointer-events: none;
  173. }
  174. /* ---- 五角星形状(clip-path) ---- */
  175. .star-shape {
  176. position: absolute;
  177. width: 320rpx;
  178. height: 304rpx;
  179. top: 50%;
  180. left: 50%;
  181. transform: translate(-50%, -50%);
  182. pointer-events: none;
  183. }
  184. .star-shape__fill {
  185. position: absolute;
  186. inset: 0;
  187. clip-path: polygon(
  188. 50% 0%, 61% 35%, 98% 35%, 68% 57%,
  189. 79% 91%, 50% 70%, 21% 91%, 32% 57%,
  190. 2% 35%, 39% 35%
  191. );
  192. background: linear-gradient(135deg, rgba(255, 215, 0, 0.12), rgba(255, 180, 50, 0.04));
  193. animation: starPulse 4s ease-in-out infinite;
  194. }
  195. .star-shape__outline {
  196. position: absolute;
  197. inset: -2rpx;
  198. clip-path: polygon(
  199. 50% 0%, 61% 35%, 98% 35%, 68% 57%,
  200. 79% 91%, 50% 70%, 21% 91%, 32% 57%,
  201. 2% 35%, 39% 35%
  202. );
  203. background: transparent;
  204. border: 1rpx solid rgba(255, 215, 0, 0.15);
  205. /* fake border via slightly larger duplicate */
  206. }
  207. /* Real outline using pseudo element trick */
  208. .star-shape__outline::before {
  209. content: '';
  210. position: absolute;
  211. inset: 0;
  212. clip-path: polygon(
  213. 50% 0%, 61% 35%, 98% 35%, 68% 57%,
  214. 79% 91%, 50% 70%, 21% 91%, 32% 57%,
  215. 2% 35%, 39% 35%
  216. );
  217. background: transparent;
  218. box-shadow: 0 0 20rpx rgba(255, 215, 0, 0.06);
  219. }
  220. @keyframes starPulse {
  221. 0%, 100% { opacity: 1; }
  222. 50% { opacity: 0.6; }
  223. }
  224. /* ---- 五角星连线(五条边) ---- */
  225. .pentagram-lines {
  226. position: absolute;
  227. inset: 0;
  228. pointer-events: none;
  229. }
  230. .p-line {
  231. position: absolute;
  232. height: 2rpx;
  233. background: linear-gradient(90deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.05));
  234. transform-origin: left center;
  235. top: 0;
  236. left: 0;
  237. }
  238. /* Line 1: Fire → Earth (top → lower-right) */
  239. .p-line--1 { top: 46rpx; left: 250rpx; width: 290rpx; transform: rotate(68deg); }
  240. /* Line 2: Earth → Wood (lower-right → upper-left) */
  241. .p-line--2 { top: 340rpx; left: 340rpx; width: 290rpx; transform: rotate(-106deg); }
  242. /* Line 3: Wood → Water (upper-left → upper-right) */
  243. .p-line--3 { top: 156rpx; left: 72rpx; width: 364rpx; transform: rotate(0deg); }
  244. /* Line 4: Water → Metal (upper-right → lower-left) */
  245. .p-line--4 { top: 156rpx; left: 400rpx; width: 290rpx; transform: rotate(106deg); }
  246. /* Line 5: Metal → Fire (lower-left → top) */
  247. .p-line--5 { top: 340rpx; left: 100rpx; width: 290rpx; transform: rotate(-68deg); }
  248. /* ============================================================
  249. 顶点
  250. ============================================================ */
  251. .star-point {
  252. position: absolute;
  253. display: flex;
  254. flex-direction: column;
  255. align-items: center;
  256. transform: translate(-50%, -50%);
  257. z-index: 3;
  258. cursor: pointer;
  259. }
  260. .point-hover {
  261. opacity: 0.8;
  262. }
  263. /* 顶点定位 */
  264. .star-point--top { top: 8%; left: 50%; }
  265. .star-point--ur { top: 32%; left: 84%; }
  266. .star-point--lr { top: 76%; left: 72%; }
  267. .star-point--ll { top: 76%; left: 28%; }
  268. .star-point--ul { top: 32%; left: 16%; }
  269. /* ---- 顶点光晕 ---- */
  270. .point-glow {
  271. position: absolute;
  272. width: 90rpx;
  273. height: 90rpx;
  274. top: 50%;
  275. left: 50%;
  276. transform: translate(-50%, -50%);
  277. border-radius: 50%;
  278. opacity: 0.25;
  279. pointer-events: none;
  280. }
  281. .point-glow--fire { background: radial-gradient(circle, #FF6B35, transparent 70%); }
  282. .point-glow--water { background: radial-gradient(circle, #42A5F5, transparent 70%); }
  283. .point-glow--earth { background: radial-gradient(circle, #8D6E63, transparent 70%); }
  284. .point-glow--metal { background: radial-gradient(circle, #FFD700, transparent 70%); }
  285. .point-glow--wood { background: radial-gradient(circle, #4CAF50, transparent 70%); }
  286. /* ---- 顶点圆点 ---- */
  287. .point-dot {
  288. width: 56rpx;
  289. height: 56rpx;
  290. border-radius: 50%;
  291. display: flex;
  292. align-items: center;
  293. justify-content: center;
  294. position: relative;
  295. z-index: 1;
  296. }
  297. .point-dot--fire { background: linear-gradient(135deg, #FF6B35, #E65100); box-shadow: 0 0 16rpx rgba(255, 107, 53, 0.4); }
  298. .point-dot--water { background: linear-gradient(135deg, #42A5F5, #1565C0); box-shadow: 0 0 16rpx rgba(66, 165, 245, 0.4); }
  299. .point-dot--earth { background: linear-gradient(135deg, #8D6E63, #5D4037); box-shadow: 0 0 16rpx rgba(141, 110, 99, 0.4); }
  300. .point-dot--metal { background: linear-gradient(135deg, #FFD700, #FF8F00); box-shadow: 0 0 16rpx rgba(255, 215, 0, 0.4); }
  301. .point-dot--wood { background: linear-gradient(135deg, #4CAF50, #2E7D32); box-shadow: 0 0 16rpx rgba(76, 175, 80, 0.4); }
  302. .point-icon {
  303. font-size: 28rpx;
  304. line-height: 1;
  305. }
  306. /* ---- 顶点标签 ---- */
  307. .point-label {
  308. font-size: 20rpx;
  309. color: rgba(255, 255, 255, 0.9);
  310. font-weight: bold;
  311. margin-top: 8rpx;
  312. white-space: nowrap;
  313. }
  314. .point-status {
  315. font-size: 16rpx;
  316. color: #F97316;
  317. margin-top: 2rpx;
  318. white-space: nowrap;
  319. }
  320. /* ============================================================
  321. 中心圆
  322. ============================================================ */
  323. .star-center {
  324. position: absolute;
  325. top: 50%;
  326. left: 50%;
  327. transform: translate(-50%, -50%);
  328. width: 110rpx;
  329. height: 110rpx;
  330. border-radius: 50%;
  331. display: flex;
  332. flex-direction: column;
  333. justify-content: center;
  334. align-items: center;
  335. z-index: 4;
  336. background: radial-gradient(circle at 40% 35%, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.03));
  337. border: 1rpx solid rgba(255, 215, 0, 0.2);
  338. box-shadow: 0 0 30rpx rgba(255, 215, 0, 0.08), inset 0 0 20rpx rgba(255, 215, 0, 0.04);
  339. animation: centerPulse 3s ease-in-out infinite;
  340. }
  341. @keyframes centerPulse {
  342. 0%, 100% { box-shadow: 0 0 30rpx rgba(255, 215, 0, 0.08), inset 0 0 20rpx rgba(255, 215, 0, 0.04); }
  343. 50% { box-shadow: 0 0 40rpx rgba(255, 215, 0, 0.15), inset 0 0 30rpx rgba(255, 215, 0, 0.08); }
  344. }
  345. .center-icon-wrap {
  346. width: 36rpx;
  347. height: 36rpx;
  348. display: flex;
  349. align-items: center;
  350. justify-content: center;
  351. margin-bottom: 2rpx;
  352. }
  353. .center-icon {
  354. font-size: 28rpx;
  355. color: #FFD700;
  356. }
  357. .center-text {
  358. font-size: 20rpx;
  359. color: #FFD700;
  360. font-weight: bold;
  361. line-height: 1.3;
  362. }
  363. .center-sub {
  364. font-size: 16rpx;
  365. color: rgba(255, 215, 0, 0.5);
  366. line-height: 1.2;
  367. }
  368. /* ============================================================
  369. 提示 & 维度条
  370. ============================================================ */
  371. .shenke-hint {
  372. text-align: center;
  373. margin-top: 8rpx;
  374. position: relative;
  375. z-index: 2;
  376. }
  377. .hint-text {
  378. font-size: 22rpx;
  379. color: rgba(255, 215, 0, 0.7);
  380. }
  381. .dimension-bar {
  382. display: flex;
  383. align-items: center;
  384. justify-content: center;
  385. margin-top: 16rpx;
  386. gap: 6rpx;
  387. position: relative;
  388. z-index: 2;
  389. }
  390. .dim-item {
  391. font-size: 20rpx;
  392. padding: 4rpx 12rpx;
  393. border-radius: 10rpx;
  394. }
  395. .dim-item--wood { color: #4CAF50; background: rgba(76, 175, 80, 0.1); }
  396. .dim-item--fire { color: #FF6B35; background: rgba(255, 107, 53, 0.1); }
  397. .dim-item--earth { color: #8D6E63; background: rgba(141, 110, 99, 0.1); }
  398. .dim-item--metal { color: #FFD700; background: rgba(255, 215, 0, 0.1); }
  399. .dim-item--water { color: #42A5F5; background: rgba(66, 165, 245, 0.1); }
  400. .dim-arrow {
  401. font-size: 18rpx;
  402. color: rgba(255, 255, 255, 0.2);
  403. }
  404. </style>