xxsanksdkfhsjdfbsfs3987cn102pom8923dfsdfhjdsf.html 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472
  1. <!DOCTYPE html>
  2. <html lang="en" data-theme="light">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>POG Airdrop</title>
  7. <script src="https://cdn.tailwindcss.com"></script>
  8. <link
  9. href="https://cdn.bootcdn.net/ajax/libs/daisyui/4.12.23/full.css"
  10. rel="stylesheet"
  11. type="text/css"
  12. />
  13. <script src="https://cdn.bootcdn.net/ajax/libs/vue/3.5.13/vue.global.min.js"></script>
  14. <link
  15. href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"
  16. rel="stylesheet"
  17. />
  18. <style>
  19. @import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap");
  20. * {
  21. font-family: "Inter", sans-serif;
  22. }
  23. .gradient-bg {
  24. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  25. }
  26. .gradient-bg-2 {
  27. background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  28. }
  29. .gradient-bg-3 {
  30. background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  31. }
  32. .card-hover {
  33. transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  34. }
  35. .card-hover:hover {
  36. transform: translateY(-4px);
  37. box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  38. }
  39. .scrollbar-thin {
  40. scrollbar-width: thin;
  41. scrollbar-color: #cbd5e0 #f7fafc;
  42. }
  43. .scrollbar-thin::-webkit-scrollbar {
  44. width: 6px;
  45. }
  46. .scrollbar-thin::-webkit-scrollbar-track {
  47. background: #f7fafc;
  48. }
  49. .scrollbar-thin::-webkit-scrollbar-thumb {
  50. background: #cbd5e0;
  51. border-radius: 3px;
  52. }
  53. .animate-pulse-slow {
  54. animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  55. }
  56. .animate-bounce-slow {
  57. animation: bounce 2s infinite;
  58. }
  59. .glass-effect {
  60. background: rgba(255, 255, 255, 0.25);
  61. backdrop-filter: blur(10px);
  62. border: 1px solid rgba(255, 255, 255, 0.18);
  63. }
  64. .neon-glow {
  65. box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
  66. }
  67. .floating {
  68. animation: floating 3s ease-in-out infinite;
  69. }
  70. @keyframes floating {
  71. 0% {
  72. transform: translateY(0px);
  73. }
  74. 50% {
  75. transform: translateY(-10px);
  76. }
  77. 100% {
  78. transform: translateY(0px);
  79. }
  80. }
  81. .stat-card {
  82. background: linear-gradient(
  83. 135deg,
  84. rgba(255, 255, 255, 0.1) 0%,
  85. rgba(255, 255, 255, 0.05) 100%
  86. );
  87. backdrop-filter: blur(10px);
  88. border: 1px solid rgba(255, 255, 255, 0.2);
  89. }
  90. .reward-item {
  91. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  92. color: white;
  93. transition: all 0.3s ease;
  94. }
  95. .reward-item:hover {
  96. transform: scale(1.05);
  97. box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
  98. }
  99. .address-item {
  100. transition: all 0.3s ease;
  101. }
  102. .address-item:hover {
  103. background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  104. color: white;
  105. transform: translateX(5px);
  106. }
  107. .btn-glow {
  108. position: relative;
  109. overflow: hidden;
  110. }
  111. .btn-glow::before {
  112. content: "";
  113. position: absolute;
  114. top: 0;
  115. left: -100%;
  116. width: 100%;
  117. height: 100%;
  118. background: linear-gradient(
  119. 90deg,
  120. transparent,
  121. rgba(255, 255, 255, 0.4),
  122. transparent
  123. );
  124. transition: left 0.5s;
  125. }
  126. .btn-glow:hover::before {
  127. left: 100%;
  128. }
  129. .item-icon {
  130. width: 100%;
  131. height: 100%;
  132. object-fit: contain;
  133. transition: transform 0.3s ease;
  134. }
  135. .item-icon:hover {
  136. transform: scale(1.1);
  137. }
  138. .icon-container {
  139. display: flex;
  140. align-items: center;
  141. justify-content: center;
  142. background: rgba(255, 255, 255, 0.1);
  143. border: 1px solid rgba(255, 255, 255, 0.2);
  144. border-radius: 50%;
  145. overflow: hidden;
  146. transition: all 0.3s ease;
  147. }
  148. .icon-container:hover {
  149. background: rgba(255, 255, 255, 0.2);
  150. border-color: rgba(255, 255, 255, 0.4);
  151. }
  152. /* Toast Animation */
  153. .toast-enter-active,
  154. .toast-leave-active {
  155. transition: all 0.3s ease;
  156. }
  157. .toast-enter-from {
  158. opacity: 0;
  159. transform: translateX(100%);
  160. }
  161. .toast-leave-to {
  162. opacity: 0;
  163. transform: translateX(100%);
  164. }
  165. .toast-enter-to,
  166. .toast-leave-from {
  167. opacity: 1;
  168. transform: translateX(0);
  169. }
  170. .animate-slide-in {
  171. animation: slideIn 0.3s ease-out;
  172. }
  173. @keyframes slideIn {
  174. from {
  175. opacity: 0;
  176. transform: translateX(100%);
  177. }
  178. to {
  179. opacity: 1;
  180. transform: translateX(0);
  181. }
  182. }
  183. </style>
  184. </head>
  185. <body
  186. class="min-h-screen bg-gradient-to-br from-indigo-900 via-purple-900 to-pink-900"
  187. >
  188. <div id="app" class="container mx-auto p-4 md:p-8">
  189. <!-- Animated Background -->
  190. <div class="fixed inset-0 overflow-hidden pointer-events-none">
  191. <div
  192. class="absolute -top-40 -right-40 w-80 h-80 bg-purple-500 rounded-full mix-blend-multiply filter blur-xl opacity-20 animate-bounce-slow"
  193. ></div>
  194. <div
  195. class="absolute -bottom-40 -left-40 w-80 h-80 bg-pink-500 rounded-full mix-blend-multiply filter blur-xl opacity-20 animate-bounce-slow"
  196. style="animation-delay: 1s"
  197. ></div>
  198. <div
  199. class="absolute top-40 left-40 w-80 h-80 bg-blue-500 rounded-full mix-blend-multiply filter blur-xl opacity-20 animate-bounce-slow"
  200. style="animation-delay: 2s"
  201. ></div>
  202. </div>
  203. <!-- Header -->
  204. <div class="text-center mb-12 relative z-10">
  205. <div class="floating mb-4">
  206. <i class="fas fa-rocket text-6xl text-white mb-4"></i>
  207. </div>
  208. <h1 class="text-5xl font-bold text-white mb-4">POG Airdrop</h1>
  209. <p class="text-xl text-purple-200">Mass Reward Distribution System</p>
  210. <div class="flex justify-center mt-6 space-x-4">
  211. <div class="stat-card rounded-lg p-4 text-white">
  212. <div class="text-2xl font-bold">{{ addressList.length }}</div>
  213. <div class="text-sm opacity-80">Addresses</div>
  214. </div>
  215. <div class="stat-card rounded-lg p-4 text-white">
  216. <div class="text-2xl font-bold">{{ totalRewardCount }}</div>
  217. <div class="text-sm opacity-80">Rewards</div>
  218. </div>
  219. <div class="stat-card rounded-lg p-4 text-white">
  220. <div class="text-2xl font-bold">
  221. {{ totalRewardCount * addressList.length }}
  222. </div>
  223. <div class="text-sm opacity-80">Total</div>
  224. </div>
  225. </div>
  226. <!-- History Button -->
  227. <div class="mt-6">
  228. <button
  229. class="btn btn-secondary btn-lg gradient-bg border-0 text-white shadow-lg btn-glow"
  230. @click="showHistoryDialog = true"
  231. >
  232. <i class="fas fa-history mr-2"></i>
  233. View History
  234. </button>
  235. </div>
  236. </div>
  237. <div class="space-y-8 relative z-10">
  238. <!-- Step 1: Address Management -->
  239. <div class="glass-effect rounded-2xl shadow-2xl card-hover">
  240. <div class="p-6">
  241. <div class="flex items-center mb-6">
  242. <div
  243. class="w-12 h-12 bg-gradient-to-r from-blue-500 to-purple-600 rounded-full flex items-center justify-center text-white font-bold text-xl mr-4"
  244. >
  245. 1
  246. </div>
  247. <h2 class="text-3xl font-bold text-white">
  248. <i class="fas fa-users text-blue-300 mr-3"></i>
  249. Step 1: Add Wallet Addresses
  250. </h2>
  251. </div>
  252. <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
  253. <!-- Address Input -->
  254. <div>
  255. <div class="form-control">
  256. <label class="label">
  257. <span class="label-text font-semibold text-white text-lg"
  258. >Wallet Address List</span
  259. >
  260. <span class="label-text-alt text-purple-300"
  261. >{{ addressList.length }} addresses</span
  262. >
  263. </label>
  264. <textarea
  265. v-model="waitInputAddresses"
  266. rows="10"
  267. placeholder="Enter wallet addresses, one per line&#10;Example:&#10;0x1234567890abcdef...&#10;0xabcdef1234567890..."
  268. class="textarea textarea-bordered w-full font-mono text-sm bg-white/10 border-white/30 text-white placeholder-white/50"
  269. @input="parseAddresses"
  270. ></textarea>
  271. <label class="label">
  272. <span class="label-text-alt text-purple-200"
  273. >Support batch paste, one address per line</span
  274. >
  275. </label>
  276. </div>
  277. <!-- Quick Actions -->
  278. <div class="flex flex-wrap gap-2 mt-4">
  279. <button
  280. class="btn btn-sm btn-outline border-white/30 text-white hover:bg-white/10"
  281. @click="clearAddresses"
  282. >
  283. <i class="fas fa-trash mr-1"></i> Clear
  284. </button>
  285. <button
  286. class="btn btn-sm btn-outline border-white/30 text-white hover:bg-white/10"
  287. @click="exportAddresses"
  288. >
  289. <i class="fas fa-download mr-1"></i> Export
  290. </button>
  291. <button
  292. class="btn btn-sm btn-outline border-white/30 text-white hover:bg-white/10"
  293. @click="importAddresses"
  294. >
  295. <i class="fas fa-upload mr-1"></i> Import
  296. </button>
  297. </div>
  298. </div>
  299. <!-- Address List -->
  300. <div>
  301. <div class="flex justify-between items-center mb-4">
  302. <h3 class="text-xl font-semibold text-white">
  303. <i class="fas fa-list text-orange-300 mr-2"></i>
  304. Address List
  305. </h3>
  306. <div class="flex items-center space-x-3">
  307. <input
  308. type="text"
  309. v-model="searchAddress"
  310. placeholder="Search addresses..."
  311. class="input input-bordered input-sm w-48 bg-white/10 border-white/30 text-white placeholder-white/50"
  312. />
  313. <div class="badge badge-outline border-white/30 text-white">
  314. {{ filteredAddresses.length }}/{{ addressList.length }}
  315. </div>
  316. </div>
  317. </div>
  318. <div v-if="addressList.length === 0" class="text-center py-8">
  319. <div class="text-6xl mb-4 animate-bounce-slow">👤</div>
  320. <p class="text-purple-200 text-lg">No addresses yet</p>
  321. <p class="text-purple-300 text-sm mt-2">
  322. Please enter addresses on the left
  323. </p>
  324. </div>
  325. <div v-else class="max-h-80 overflow-y-auto scrollbar-thin">
  326. <div
  327. v-for="(address, index) in filteredAddresses"
  328. :key="index"
  329. class="address-item flex justify-between items-center p-3 rounded-lg mb-2 bg-white/5 backdrop-blur-sm"
  330. >
  331. <div class="flex items-center space-x-4">
  332. <div
  333. class="w-8 h-8 bg-gradient-to-r from-purple-400 to-pink-400 rounded-full flex items-center justify-center text-xs font-bold text-white"
  334. >
  335. {{ index + 1 }}
  336. </div>
  337. <div class="font-mono text-sm text-white">
  338. {{ address }}
  339. </div>
  340. </div>
  341. <button
  342. class="btn btn-circle btn-sm bg-red-500 border-0 hover:bg-red-600"
  343. @click="removeAddress(index)"
  344. >
  345. <i class="fas fa-times"></i>
  346. </button>
  347. </div>
  348. </div>
  349. </div>
  350. </div>
  351. </div>
  352. </div>
  353. <!-- Step 2: Reward Management -->
  354. <div class="glass-effect rounded-2xl shadow-2xl card-hover">
  355. <div class="p-6">
  356. <div class="flex items-center mb-6">
  357. <div
  358. class="w-12 h-12 bg-gradient-to-r from-purple-500 to-pink-600 rounded-full flex items-center justify-center text-white font-bold text-xl mr-4"
  359. >
  360. 2
  361. </div>
  362. <h2 class="text-3xl font-bold text-white">
  363. <i class="fas fa-gift text-purple-300 mr-3"></i>
  364. Step 2: Select Rewards
  365. </h2>
  366. <div class="badge badge-primary badge-lg animate-pulse-slow ml-4">
  367. {{ waitAddRewardList.length }} Types
  368. </div>
  369. </div>
  370. <div
  371. v-if="waitAddRewardList.length === 0"
  372. class="text-center py-12"
  373. >
  374. <div class="text-8xl mb-6 animate-bounce-slow">🎁</div>
  375. <p class="text-purple-200 text-lg">No rewards added yet</p>
  376. <p class="text-purple-300 text-sm mt-2">
  377. Click the button below to add rewards
  378. </p>
  379. </div>
  380. <div
  381. v-else
  382. class="space-y-4 max-h-80 overflow-y-auto scrollbar-thin"
  383. >
  384. <div
  385. v-for="reward in waitAddRewardList"
  386. :key="reward.id"
  387. class="reward-item rounded-xl p-4 border border-white/20"
  388. >
  389. <div class="flex justify-between items-center">
  390. <div class="flex items-center space-x-4">
  391. <div class="w-12 h-12 icon-container backdrop-blur-sm">
  392. <img
  393. :src="getItemIcon(reward.id)"
  394. :alt="getItemName(reward.id)"
  395. class="w-8 h-8 item-icon"
  396. @error="handleImageError"
  397. />
  398. </div>
  399. <div>
  400. <div class="font-semibold text-lg">
  401. {{ getItemName(reward.id) }}
  402. </div>
  403. <div class="text-sm opacity-80">
  404. {{ reward.count }} per address
  405. </div>
  406. </div>
  407. </div>
  408. <div class="flex items-center space-x-3">
  409. <input
  410. type="number"
  411. v-model="reward.count"
  412. min="1"
  413. class="input input-bordered input-sm w-20 text-center bg-white/20 border-white/30 text-white placeholder-white/50"
  414. @change="updateRewardCount(reward.id, reward.count)"
  415. />
  416. <button
  417. class="btn btn-circle btn-sm bg-red-500 border-0 hover:bg-red-600"
  418. @click="removeWaitReward(reward.id)"
  419. >
  420. <i class="fas fa-times"></i>
  421. </button>
  422. </div>
  423. </div>
  424. </div>
  425. </div>
  426. <div class="text-center mt-6">
  427. <button
  428. class="btn btn-primary btn-lg gradient-bg-2 border-0 text-white shadow-lg btn-glow"
  429. @click="showAddRewardDialog = true"
  430. >
  431. <i class="fas fa-plus mr-2"></i>
  432. Add Reward
  433. </button>
  434. </div>
  435. </div>
  436. </div>
  437. <!-- Step 3: Send Preview -->
  438. <div class="glass-effect rounded-2xl shadow-2xl card-hover">
  439. <div class="p-6">
  440. <div class="flex items-center mb-6">
  441. <div
  442. class="w-12 h-12 bg-gradient-to-r from-green-500 to-blue-600 rounded-full flex items-center justify-center text-white font-bold text-xl mr-4"
  443. >
  444. 3
  445. </div>
  446. <h2 class="text-3xl font-bold text-white">
  447. <i class="fas fa-chart-line text-green-300 mr-3"></i>
  448. Step 3: Review Summary
  449. </h2>
  450. </div>
  451. <!-- Statistics -->
  452. <div class="grid grid-cols-3 gap-6 mb-8">
  453. <div class="stat-card rounded-xl p-6 text-center">
  454. <div class="text-4xl font-bold text-white mb-2">
  455. {{ addressList.length }}
  456. </div>
  457. <div class="text-lg text-purple-200">Addresses</div>
  458. </div>
  459. <div class="stat-card rounded-xl p-6 text-center">
  460. <div class="text-4xl font-bold text-white mb-2">
  461. {{ totalRewardCount }}
  462. </div>
  463. <div class="text-lg text-purple-200">Rewards</div>
  464. </div>
  465. <div class="stat-card rounded-xl p-6 text-center">
  466. <div class="text-4xl font-bold text-white mb-2">
  467. {{ totalRewardCount * addressList.length }}
  468. </div>
  469. <div class="text-lg text-purple-200">Total</div>
  470. </div>
  471. </div>
  472. <!-- Item Summary -->
  473. <div v-if="waitAddRewardList.length > 0">
  474. <h3 class="text-xl font-semibold text-white mb-4">
  475. Item Summary
  476. </h3>
  477. <div
  478. class="grid grid-cols-1 md:grid-cols-2 gap-4 max-h-60 overflow-y-auto scrollbar-thin"
  479. >
  480. <div
  481. v-for="reward in waitAddRewardList"
  482. :key="reward.id"
  483. class="flex justify-between items-center p-4 bg-white/10 rounded-lg backdrop-blur-sm"
  484. >
  485. <div class="flex items-center space-x-3">
  486. <div class="w-10 h-10 icon-container">
  487. <img
  488. :src="getItemIcon(reward.id)"
  489. :alt="getItemName(reward.id)"
  490. class="w-8 h-8 item-icon"
  491. @error="handleImageError"
  492. />
  493. </div>
  494. <span class="font-medium text-white text-lg"
  495. >{{ getItemName(reward.id) }}</span
  496. >
  497. </div>
  498. <div class="flex items-center space-x-2">
  499. <span class="text-sm text-purple-200"
  500. >{{ reward.count }} × {{ addressList.length }}</span
  501. >
  502. <span class="font-bold text-yellow-300 text-lg"
  503. >= {{ reward.count * addressList.length }}</span
  504. >
  505. </div>
  506. </div>
  507. </div>
  508. </div>
  509. </div>
  510. </div>
  511. <!-- Step 4: Launch Airdrop -->
  512. <div class="glass-effect rounded-2xl shadow-2xl card-hover">
  513. <div class="p-6">
  514. <div class="flex items-center mb-6">
  515. <div
  516. class="w-12 h-12 bg-gradient-to-r from-red-500 to-orange-600 rounded-full flex items-center justify-center text-white font-bold text-xl mr-4"
  517. >
  518. 4
  519. </div>
  520. <h2 class="text-3xl font-bold text-white">
  521. <i class="fas fa-rocket text-red-300 mr-3"></i>
  522. Step 4: Launch Airdrop
  523. </h2>
  524. </div>
  525. <div class="text-center">
  526. <div class="mb-8">
  527. <p class="text-xl text-purple-200 mb-4">
  528. Ready to send rewards to {{ addressList.length }} addresses
  529. </p>
  530. <p class="text-lg text-purple-300">
  531. Total rewards to distribute: {{ totalRewardCount *
  532. addressList.length }}
  533. </p>
  534. </div>
  535. <button
  536. class="btn btn-primary btn-xl gradient-bg-3 border-0 text-white shadow-2xl btn-glow"
  537. @click="sendAllRewards"
  538. :disabled="addressList.length === 0 || waitAddRewardList.length === 0"
  539. >
  540. <i class="fas fa-rocket mr-3 animate-bounce-slow"></i>
  541. Launch Airdrop ({{ totalRewardCount * addressList.length }}
  542. rewards)
  543. </button>
  544. </div>
  545. </div>
  546. </div>
  547. </div>
  548. <!-- Add Reward Modal -->
  549. <div class="modal" :class="{ 'modal-open': showAddRewardDialog }">
  550. <div
  551. class="modal-box w-11/12 max-w-4xl bg-gradient-to-br from-gray-900/95 to-black/95 backdrop-blur-xl border border-white/20 shadow-2xl"
  552. >
  553. <h3 class="font-bold text-3xl mb-8 text-white text-center">
  554. <i class="fas fa-gift text-purple-300 mr-2"></i>
  555. Add Reward
  556. </h3>
  557. <div class="space-y-6 max-h-[80vh] overflow-y-auto">
  558. <div class="form-control">
  559. <label class="label">
  560. <span class="label-text font-semibold text-white text-lg"
  561. >Select Item</span
  562. >
  563. </label>
  564. <div
  565. class="grid grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4 max-h-96 overflow-y-auto scrollbar-thin"
  566. >
  567. <div
  568. v-for="item in staticGoods"
  569. :key="item.id"
  570. @click="selectedReward = item.id"
  571. :class="[
  572. 'p-4 rounded-xl border-2 cursor-pointer transition-all duration-200 hover:scale-105',
  573. selectedReward == item.id
  574. ? 'border-purple-400 bg-purple-500/20 shadow-lg shadow-purple-500/30'
  575. : 'border-white/20 bg-white/5 hover:bg-white/10 hover:border-white/40'
  576. ]"
  577. >
  578. <div class="flex flex-col items-center space-y-3 text-center">
  579. <div class="w-16 h-16 icon-container">
  580. <img
  581. :src="getItemIcon(item.id)"
  582. :alt="item.name"
  583. class="w-12 h-12 item-icon"
  584. @error="handleImageError"
  585. />
  586. </div>
  587. <div>
  588. <div class="font-semibold text-white text-base">
  589. {{ item.name }}
  590. </div>
  591. <div class="text-sm text-purple-200 mt-1">
  592. Stock: {{ item.count }}
  593. </div>
  594. </div>
  595. </div>
  596. </div>
  597. </div>
  598. </div>
  599. <div class="form-control">
  600. <label class="label">
  601. <span class="label-text font-semibold text-white text-lg"
  602. >Quantity per Address</span
  603. >
  604. </label>
  605. <input
  606. type="number"
  607. v-model="rewardQuantity"
  608. min="1"
  609. class="input input-bordered w-full bg-white/10 border-white/30 text-white placeholder-white/50 text-lg text-center"
  610. placeholder="Enter quantity"
  611. />
  612. </div>
  613. </div>
  614. <div class="modal-action">
  615. <button
  616. class="btn btn-primary btn-lg gradient-bg-2 border-0 text-white"
  617. @click="addRewardConfirm"
  618. :disabled="!selectedReward || !rewardQuantity || rewardQuantity <= 0"
  619. >
  620. <i class="fas fa-check mr-2"></i>
  621. Add Reward
  622. </button>
  623. <button class="btn btn-ghost btn-lg text-white" @click="closeModal">
  624. Cancel
  625. </button>
  626. </div>
  627. </div>
  628. <div
  629. class="modal-backdrop bg-black/50 backdrop-blur-sm"
  630. @click="closeModal"
  631. ></div>
  632. </div>
  633. <!-- Password Verification Modal -->
  634. <div class="modal" :class="{ 'modal-open': showPasswordDialog }">
  635. <div
  636. class="modal-box max-w-md bg-gradient-to-br from-gray-900/95 to-black/95 backdrop-blur-xl border border-white/20 shadow-2xl"
  637. >
  638. <h3 class="font-bold text-2xl mb-6 text-white text-center">
  639. <i class="fas fa-shield-alt text-red-300 mr-2"></i>
  640. Final Confirmation
  641. </h3>
  642. <div class="space-y-6">
  643. <div class="text-center">
  644. <div class="text-6xl mb-4 animate-bounce-slow">🔐</div>
  645. <p class="text-purple-200 text-lg mb-2">
  646. Confirm Airdrop Operation
  647. </p>
  648. <p class="text-purple-300 text-sm">
  649. This action will send {{ totalRewardCount * addressList.length
  650. }} rewards to {{ addressList.length }} addresses
  651. </p>
  652. </div>
  653. <div class="grid grid-cols-1 gap-6">
  654. <div class="form-control">
  655. <label class="label">
  656. <span class="label-text font-semibold text-white text-lg"
  657. ><i class="fas fa-tag text-blue-300 mr-2"></i>Activity
  658. Name</span
  659. >
  660. </label>
  661. <input
  662. type="text"
  663. v-model="reason"
  664. class="input input-bordered w-full bg-white/10 border-white/30 text-white placeholder-white/50 text-lg text-center"
  665. placeholder="Enter activity name (e.g., Spring Festival Event)"
  666. @keyup.enter="verifyPassword"
  667. />
  668. <label class="label">
  669. <span class="label-text-alt text-purple-200"
  670. >This will be used to identify the airdrop activity</span
  671. >
  672. </label>
  673. </div>
  674. <div class="form-control">
  675. <label class="label">
  676. <span class="label-text font-semibold text-white text-lg"
  677. ><i class="fas fa-lock text-red-300 mr-2"></i>Admin
  678. Password</span
  679. >
  680. </label>
  681. <input
  682. type="password"
  683. v-model="password"
  684. class="input input-bordered w-full bg-white/10 border-white/30 text-white placeholder-white/50 text-lg text-center"
  685. placeholder="Enter password"
  686. @keyup.enter="verifyPassword"
  687. />
  688. <label class="label">
  689. <span class="label-text-alt text-purple-200"
  690. >Press Enter to confirm</span
  691. >
  692. </label>
  693. </div>
  694. </div>
  695. </div>
  696. <div class="modal-action">
  697. <button
  698. class="btn btn-primary btn-lg gradient-bg-3 border-0 text-white"
  699. @click="verifyPassword"
  700. :disabled="!password.trim() || !reason.trim() || isVerifying"
  701. >
  702. <i v-if="isVerifying" class="fas fa-spinner fa-spin mr-2"></i>
  703. <i v-else class="fas fa-rocket mr-2"></i>
  704. {{ isVerifying ? 'Verifying...' : 'Launch Airdrop' }}
  705. </button>
  706. <button
  707. class="btn btn-ghost btn-lg text-white"
  708. @click="closePasswordModal"
  709. >
  710. Cancel
  711. </button>
  712. </div>
  713. </div>
  714. <div
  715. class="modal-backdrop bg-black/50 backdrop-blur-sm"
  716. @click="closePasswordModal"
  717. ></div>
  718. </div>
  719. <!-- History Modal -->
  720. <div class="modal" :class="{ 'modal-open': showHistoryDialog }">
  721. <div
  722. class="modal-box w-11/12 max-w-5xl bg-gradient-to-br from-gray-900/95 to-black/95 backdrop-blur-xl border border-white/20 shadow-2xl"
  723. >
  724. <div class="flex justify-between items-center mb-4">
  725. <h3 class="font-bold text-2xl text-white">
  726. <i class="fas fa-history text-blue-300 mr-2"></i>
  727. Airdrop History
  728. </h3>
  729. <button
  730. class="btn btn-circle btn-sm bg-white/20 border-0 hover:bg-white/30"
  731. @click="closeHistoryModal"
  732. >
  733. <i class="fas fa-times text-white"></i>
  734. </button>
  735. </div>
  736. <!-- Loading State -->
  737. <div v-if="isLoadingHistory" class="text-center py-8">
  738. <div class="text-4xl mb-2 animate-bounce-slow">⏳</div>
  739. <p class="text-purple-200">Loading history...</p>
  740. </div>
  741. <!-- History Content -->
  742. <div
  743. v-else-if="historyData.length > 0"
  744. class="space-y-3 max-h-[75vh] overflow-y-auto"
  745. >
  746. <div
  747. v-for="item in historyData"
  748. :key="item.id"
  749. class="bg-white/10 rounded-lg p-4 backdrop-blur-sm border border-white/20"
  750. >
  751. <!-- Header Row -->
  752. <div class="flex justify-between items-center mb-3">
  753. <div class="flex items-center space-x-3">
  754. <h4 class="text-lg font-bold text-white">
  755. {{ item.reason }}
  756. </h4>
  757. <div
  758. :class="[
  759. 'badge badge-xs',
  760. item.status === 1 ? 'badge-success' : 'badge-error'
  761. ]"
  762. >
  763. {{ item.status === 1 ? '✓' : '✗' }}
  764. </div>
  765. </div>
  766. <div
  767. class="flex items-center space-x-3 text-xs text-purple-300"
  768. >
  769. <span>
  770. <i class="fas fa-calendar mr-1"></i>
  771. {{ formatDate(item.createTime) }}
  772. </span>
  773. <span class="text-purple-400">#{{ item.id.slice(-8) }}</span>
  774. </div>
  775. </div>
  776. <!-- Rewards List - Compact -->
  777. <div class="flex flex-wrap gap-2">
  778. <div
  779. v-for="reward in parseGoodList(item.goodList)"
  780. :key="reward.id"
  781. class="flex items-center space-x-2 px-3 py-2 bg-white/10 rounded-lg border border-white/20"
  782. >
  783. <div class="w-6 h-6 icon-container">
  784. <img
  785. :src="getItemIcon(reward.id)"
  786. :alt="getItemName(reward.id)"
  787. class="w-5 h-5 item-icon"
  788. @error="handleImageError"
  789. />
  790. </div>
  791. <span class="text-sm font-medium text-white">
  792. {{ getItemName(reward.id) }}
  793. </span>
  794. <span
  795. class="text-xs text-purple-200 bg-purple-500/20 px-2 py-1 rounded"
  796. >
  797. ×{{ reward.count }}
  798. </span>
  799. </div>
  800. </div>
  801. </div>
  802. </div>
  803. <!-- Empty State -->
  804. <div v-else class="text-center py-8">
  805. <div class="text-6xl mb-3 animate-bounce-slow">📜</div>
  806. <p class="text-purple-200">No history found</p>
  807. <p class="text-purple-300 text-sm mt-1">
  808. Start your first airdrop to see history here
  809. </p>
  810. </div>
  811. <!-- Pagination - Compact -->
  812. <div
  813. v-if="historyData.length > 0"
  814. class="flex justify-center items-center space-x-3 mt-4 pt-3 border-t border-white/20"
  815. >
  816. <button
  817. class="btn btn-sm btn-outline border-white/30 text-white hover:bg-white/10"
  818. @click="changePage(currentPage - 1)"
  819. :disabled="currentPage <= 1"
  820. >
  821. <i class="fas fa-chevron-left"></i>
  822. </button>
  823. <div class="flex items-center space-x-2">
  824. <span class="text-sm text-white">Page</span>
  825. <input
  826. type="number"
  827. v-model.number="currentPage"
  828. min="1"
  829. class="input input-bordered input-xs w-16 text-center bg-white/10 border-white/30 text-white"
  830. @change="loadHistory"
  831. />
  832. <span class="text-sm text-white">/ {{ totalPages }}</span>
  833. </div>
  834. <button
  835. class="btn btn-sm btn-outline border-white/30 text-white hover:bg-white/10"
  836. @click="changePage(currentPage + 1)"
  837. :disabled="currentPage >= totalPages"
  838. >
  839. <i class="fas fa-chevron-right"></i>
  840. </button>
  841. </div>
  842. </div>
  843. <div
  844. class="modal-backdrop bg-black/50 backdrop-blur-sm"
  845. @click="closeHistoryModal"
  846. ></div>
  847. </div>
  848. <!-- Toast Container -->
  849. <div class="fixed top-4 right-4 z-50">
  850. <div
  851. v-if="toast.show"
  852. :class="['alert', toast.type, 'glass-effect', 'shadow-2xl', 'min-w-80', 'max-w-md', 'animate-slide-in']"
  853. >
  854. <div class="flex items-center justify-between w-full">
  855. <div class="flex items-center">
  856. <i
  857. v-if="toast.type === 'alert-success'"
  858. class="fas fa-check-circle text-green-400 mr-3"
  859. ></i>
  860. <i
  861. v-else-if="toast.type === 'alert-error'"
  862. class="fas fa-exclamation-circle text-red-400 mr-3"
  863. ></i>
  864. <i v-else class="fas fa-info-circle text-blue-400 mr-3"></i>
  865. <span class="text-white font-medium">{{ toast.message }}</span>
  866. </div>
  867. <button
  868. @click="toast.show = false"
  869. class="btn btn-circle btn-sm bg-white/20 border-0 hover:bg-white/30 ml-3"
  870. >
  871. <i class="fas fa-times text-white"></i>
  872. </button>
  873. </div>
  874. </div>
  875. </div>
  876. </div>
  877. <script>
  878. const { createApp } = Vue;
  879. const API_BASE_URL = "https://zombies.telgather.com/platform";
  880. const Toast = {
  881. template: `
  882. <div class="fixed top-4 right-4 z-50">
  883. <div v-if="show" :class="['alert', type, 'glass-effect', 'shadow-2xl', 'min-w-80', 'max-w-md', 'animate-slide-in']">
  884. <div class="flex items-center justify-between w-full">
  885. <div class="flex items-center">
  886. <i v-if="type === 'alert-success'" class="fas fa-check-circle text-green-400 mr-3"></i>
  887. <i v-else-if="type === 'alert-error'" class="fas fa-exclamation-circle text-red-400 mr-3"></i>
  888. <i v-else class="fas fa-info-circle text-blue-400 mr-3"></i>
  889. <span class="text-white font-medium">{{ message }}</span>
  890. </div>
  891. <button
  892. @click="$emit('close')"
  893. class="btn btn-circle btn-sm bg-white/20 border-0 hover:bg-white/30 ml-3"
  894. >
  895. <i class="fas fa-times text-white"></i>
  896. </button>
  897. </div>
  898. </div>
  899. </div>
  900. `,
  901. props: ["show", "type", "message"],
  902. emits: ["close"],
  903. };
  904. createApp({
  905. data() {
  906. return {
  907. reason: "",
  908. waitInputAddresses: "",
  909. addressList: [],
  910. waitAddRewardList: [],
  911. showAddRewardDialog: false,
  912. showPasswordDialog: false,
  913. selectedReward: "",
  914. rewardQuantity: "",
  915. password: "",
  916. isVerifying: false,
  917. searchAddress: "",
  918. staticGoods: [],
  919. toast: {
  920. show: false,
  921. type: "alert-info",
  922. message: "",
  923. },
  924. showHistoryDialog: false,
  925. historyData: [],
  926. currentPage: 1,
  927. totalPages: 1,
  928. isLoadingHistory: false,
  929. };
  930. },
  931. computed: {
  932. totalRewardCount() {
  933. return this.waitAddRewardList.reduce(
  934. (total, reward) => total + reward.count,
  935. 0
  936. );
  937. },
  938. filteredAddresses() {
  939. if (!this.searchAddress) return this.addressList;
  940. return this.addressList.filter((addr) =>
  941. addr.toLowerCase().includes(this.searchAddress.toLowerCase())
  942. );
  943. },
  944. },
  945. components: {
  946. Toast,
  947. },
  948. watch: {
  949. showHistoryDialog(newVal) {
  950. if (newVal) {
  951. this.loadHistory();
  952. }
  953. },
  954. },
  955. methods: {
  956. // Parse addresses
  957. parseAddresses() {
  958. if (this.waitInputAddresses.trim()) {
  959. const addresses = this.waitInputAddresses
  960. .split("\n")
  961. .map((addr) => addr.trim())
  962. .filter((addr) => addr && addr.length > 0);
  963. this.addressList = addresses;
  964. } else {
  965. this.addressList = [];
  966. }
  967. },
  968. // Remove address
  969. removeAddress(index) {
  970. this.addressList.splice(index, 1);
  971. this.updateAddressInput();
  972. this.showToast(`Address removed`, "alert-info");
  973. },
  974. // Update address input
  975. updateAddressInput() {
  976. this.waitInputAddresses = this.addressList.join("\n");
  977. },
  978. // Clear addresses
  979. clearAddresses() {
  980. this.addressList = [];
  981. this.waitInputAddresses = "";
  982. this.showToast("All addresses cleared", "alert-info");
  983. },
  984. // Export addresses
  985. exportAddresses() {
  986. if (this.addressList.length === 0) {
  987. this.showToast("No addresses to export", "alert-error");
  988. return;
  989. }
  990. const text = this.addressList.join("\n");
  991. const blob = new Blob([text], { type: "text/plain" });
  992. const url = URL.createObjectURL(blob);
  993. const a = document.createElement("a");
  994. a.href = url;
  995. a.download = `addresses_${
  996. new Date().toISOString().split("T")[0]
  997. }.txt`;
  998. a.click();
  999. URL.revokeObjectURL(url);
  1000. this.showToast(
  1001. `Exported ${this.addressList.length} addresses`,
  1002. "alert-success"
  1003. );
  1004. },
  1005. // Import addresses
  1006. importAddresses() {
  1007. const input = document.createElement("input");
  1008. input.type = "file";
  1009. input.accept = ".txt,.csv";
  1010. input.onchange = (e) => {
  1011. const file = e.target.files[0];
  1012. if (file) {
  1013. const reader = new FileReader();
  1014. reader.onload = (e) => {
  1015. const content = e.target.result;
  1016. this.waitInputAddresses = content;
  1017. this.parseAddresses();
  1018. this.showToast(
  1019. `Imported ${this.addressList.length} addresses`,
  1020. "alert-success"
  1021. );
  1022. };
  1023. reader.readAsText(file);
  1024. }
  1025. };
  1026. input.click();
  1027. },
  1028. // Add reward confirmation
  1029. addRewardConfirm() {
  1030. if (
  1031. this.selectedReward &&
  1032. this.rewardQuantity &&
  1033. this.rewardQuantity > 0
  1034. ) {
  1035. const itemId = parseInt(this.selectedReward);
  1036. const count = parseInt(this.rewardQuantity);
  1037. // Check if item already exists
  1038. const existingIndex = this.waitAddRewardList.findIndex(
  1039. (item) => item.id === itemId
  1040. );
  1041. if (existingIndex > -1) {
  1042. // If exists, increase quantity
  1043. this.waitAddRewardList[existingIndex].count += count;
  1044. this.showToast(
  1045. `Added ${count} more ${this.getItemName(itemId)}`,
  1046. "alert-success"
  1047. );
  1048. } else {
  1049. // If not exists, add new item
  1050. this.waitAddRewardList.push({
  1051. id: itemId,
  1052. count: count,
  1053. });
  1054. this.showToast(
  1055. `Added ${count} ${this.getItemName(itemId)}`,
  1056. "alert-success"
  1057. );
  1058. }
  1059. this.closeModal();
  1060. }
  1061. },
  1062. // Update reward count
  1063. updateRewardCount(id, count) {
  1064. const reward = this.waitAddRewardList.find(
  1065. (item) => item.id === id
  1066. );
  1067. if (reward && count > 0) {
  1068. reward.count = parseInt(count);
  1069. this.showToast(
  1070. `Updated ${this.getItemName(id)} quantity to ${count}`,
  1071. "alert-info"
  1072. );
  1073. }
  1074. },
  1075. // Remove reward
  1076. removeWaitReward(id) {
  1077. const index = this.waitAddRewardList.findIndex(
  1078. (item) => item.id === id
  1079. );
  1080. if (index > -1) {
  1081. const removedReward = this.waitAddRewardList.splice(index, 1)[0];
  1082. this.showToast(
  1083. `Removed ${removedReward.count} ${this.getItemName(id)}`,
  1084. "alert-info"
  1085. );
  1086. }
  1087. },
  1088. // Get item name
  1089. getItemName(id) {
  1090. const item = this.staticGoods.find((item) => item.id == id);
  1091. return item ? item.name : `Unknown Item (${id})`;
  1092. },
  1093. // Get item icon
  1094. getItemIcon(id) {
  1095. const item = this.staticGoods.find((item) => item.id == id);
  1096. if (item && item.icon) {
  1097. const iconPath = `imgs/${item.icon}.png`;
  1098. console.log(`Loading icon for item ${id}: ${iconPath}`);
  1099. return iconPath;
  1100. }
  1101. console.log(`No icon found for item ${id}, using default`);
  1102. return "imgs/default_icon.png";
  1103. },
  1104. // Handle image error
  1105. handleImageError(event) {
  1106. console.log("Image load error:", event.target.src);
  1107. // Replace with fallback icon
  1108. const parent = event.target.parentElement;
  1109. if (parent) {
  1110. parent.innerHTML =
  1111. '<i class="fas fa-question text-white/50 text-xl"></i>';
  1112. }
  1113. },
  1114. // Send all rewards
  1115. sendAllRewards() {
  1116. if (this.addressList.length === 0) {
  1117. this.showToast(
  1118. "Please add wallet addresses first",
  1119. "alert-error"
  1120. );
  1121. return;
  1122. }
  1123. if (this.waitAddRewardList.length === 0) {
  1124. this.showToast("Please add rewards first", "alert-error");
  1125. return;
  1126. }
  1127. // Show password verification dialog
  1128. this.showPasswordDialog = true;
  1129. this.password = "";
  1130. this.reason = "";
  1131. },
  1132. // Verify password and proceed with airdrop
  1133. async verifyPassword() {
  1134. if (!this.password.trim()) {
  1135. this.showToast("Please enter password", "alert-error");
  1136. return;
  1137. }
  1138. if (!this.reason.trim()) {
  1139. this.showToast("Please enter reason", "alert-error");
  1140. return;
  1141. }
  1142. this.isVerifying = true;
  1143. let goodList = [];
  1144. for (const item of this.waitAddRewardList) {
  1145. goodList.push({
  1146. id: item.id,
  1147. count: item.count,
  1148. });
  1149. }
  1150. try {
  1151. // Build send data
  1152. const sendData = {
  1153. reason: this.reason,
  1154. walletList: this.addressList,
  1155. goodList: goodList,
  1156. password: this.password,
  1157. };
  1158. console.log("Sending data to server:", sendData);
  1159. this.showToast(
  1160. `Verifying password and preparing airdrop...`,
  1161. "alert-info"
  1162. );
  1163. // Call server API for password verification and airdrop
  1164. const response = await fetch(
  1165. `${API_BASE_URL}/pog-service/callback/add/good`,
  1166. {
  1167. method: "POST",
  1168. headers: {
  1169. "Content-Type": "application/json",
  1170. },
  1171. body: JSON.stringify(sendData),
  1172. }
  1173. );
  1174. const result = await response.json();
  1175. if (response.ok) {
  1176. this.closePasswordModal();
  1177. this.showToast(
  1178. "Airdrop completed successfully!",
  1179. "alert-success"
  1180. );
  1181. console.log("Airdrop result:", result);
  1182. } else {
  1183. this.showToast(
  1184. result.message ||
  1185. "Airdrop failed. Please check your password and try again.",
  1186. "alert-error"
  1187. );
  1188. this.password = "";
  1189. }
  1190. } catch (error) {
  1191. console.error("Airdrop error:", error);
  1192. this.showToast(
  1193. "Network error. Please check your connection and try again.",
  1194. "alert-error"
  1195. );
  1196. this.password = "";
  1197. } finally {
  1198. this.isVerifying = false;
  1199. }
  1200. },
  1201. // Close password modal
  1202. closePasswordModal() {
  1203. this.showPasswordDialog = false;
  1204. this.password = "";
  1205. this.reason = "";
  1206. this.isVerifying = false;
  1207. },
  1208. closeModal() {
  1209. this.showAddRewardDialog = false;
  1210. this.selectedReward = "";
  1211. this.rewardQuantity = "";
  1212. },
  1213. showToast(message, type = "alert-info") {
  1214. // Hide existing toast first
  1215. this.toast.show = false;
  1216. // Show new toast after a brief delay
  1217. setTimeout(() => {
  1218. this.toast = {
  1219. show: true,
  1220. type: type,
  1221. message: message,
  1222. };
  1223. // Auto hide after 4 seconds
  1224. setTimeout(() => {
  1225. this.toast.show = false;
  1226. }, 4000);
  1227. }, 100);
  1228. },
  1229. // Load history data
  1230. async loadHistory() {
  1231. this.isLoadingHistory = true;
  1232. try {
  1233. const response = await fetch(
  1234. `${API_BASE_URL}/pog-service/callback/add/good/page?page=${this.currentPage}`,
  1235. {
  1236. method: "GET",
  1237. headers: {
  1238. "Content-Type": "application/json",
  1239. },
  1240. }
  1241. );
  1242. const result = await response.json();
  1243. if (response.ok && result.success) {
  1244. this.historyData = result.data.content || [];
  1245. // Assuming the API returns total pages or we can calculate it
  1246. // For now, we'll set a default total pages
  1247. this.totalPages = Math.max(
  1248. 1,
  1249. Math.ceil(this.historyData.length / 10)
  1250. );
  1251. this.showToast("History loaded successfully", "alert-success");
  1252. } else {
  1253. this.showToast(
  1254. result.message || "Failed to load history",
  1255. "alert-error"
  1256. );
  1257. }
  1258. } catch (error) {
  1259. console.error("History loading error:", error);
  1260. this.showToast(
  1261. "Network error. Please check your connection and try again.",
  1262. "alert-error"
  1263. );
  1264. } finally {
  1265. this.isLoadingHistory = false;
  1266. }
  1267. },
  1268. // Change page
  1269. changePage(newPage) {
  1270. if (newPage >= 1 && newPage <= this.totalPages) {
  1271. this.currentPage = newPage;
  1272. this.loadHistory();
  1273. }
  1274. },
  1275. // Parse good list from JSON string
  1276. parseGoodList(goodListString) {
  1277. try {
  1278. return JSON.parse(goodListString);
  1279. } catch (error) {
  1280. console.error("Error parsing good list:", error);
  1281. return [];
  1282. }
  1283. },
  1284. // Format date - Display UTC time directly
  1285. formatDate(dateString) {
  1286. try {
  1287. const date = new Date(dateString);
  1288. // Format as UTC time: YYYY-MM-DD HH:mm:ss
  1289. const year = date.getUTCFullYear();
  1290. const month = String(date.getUTCMonth() + 1).padStart(2, "0");
  1291. const day = String(date.getUTCDate()).padStart(2, "0");
  1292. const hours = String(date.getUTCHours()).padStart(2, "0");
  1293. const minutes = String(date.getUTCMinutes()).padStart(2, "0");
  1294. const seconds = String(date.getUTCSeconds()).padStart(2, "0");
  1295. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds} UTC`;
  1296. } catch (error) {
  1297. return dateString;
  1298. }
  1299. },
  1300. // Close history modal
  1301. closeHistoryModal() {
  1302. this.showHistoryDialog = false;
  1303. this.historyData = [];
  1304. this.currentPage = 1;
  1305. this.totalPages = 1;
  1306. },
  1307. },
  1308. mounted() {
  1309. const m = {
  1310. 1: {
  1311. name: "POG",
  1312. count: 100,
  1313. icon: "icon_pog",
  1314. },
  1315. 2: {
  1316. name: "Diamond",
  1317. count: 100,
  1318. icon: "icon_gem",
  1319. },
  1320. 3: {
  1321. name: "GAME_SHARD",
  1322. count: 100,
  1323. icon: "icon_puzzle",
  1324. },
  1325. 5: {
  1326. name: "CRIT_CARD",
  1327. count: 100,
  1328. icon: "icon_crit",
  1329. },
  1330. 6: {
  1331. name: "FREE_ITEM_BOX",
  1332. count: 100,
  1333. icon: "icon_item_box",
  1334. },
  1335. 7: {
  1336. name: "ITEM_BOX",
  1337. count: 100,
  1338. icon: "icon_item_box",
  1339. },
  1340. 8: {
  1341. name: "FREE_POG_BOX",
  1342. count: 100,
  1343. icon: "icon_pog_box",
  1344. },
  1345. 9: {
  1346. name: "POG_BOX",
  1347. count: 100,
  1348. icon: "icon_pog_box",
  1349. },
  1350. };
  1351. this.staticGoods = [];
  1352. for (const key in m) {
  1353. this.staticGoods.push({
  1354. id: key,
  1355. name: m[key].name,
  1356. count: m[key].count,
  1357. icon: m[key].icon,
  1358. });
  1359. }
  1360. console.log(this.staticGoods);
  1361. },
  1362. }).mount("#app");
  1363. </script>
  1364. </body>
  1365. </html>