CustomCardCover.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <!-- 自定义卡片红包封面 -->
  2. <!-- todo:目前只有自定义奖品类型,货币类型待添加 -->
  3. <template>
  4. <!-- 改版之后的卡片 -->
  5. <div class="not-open-custom-card custom-card">
  6. <img
  7. class="customImg"
  8. v-if="posterType === 2 && !!customPosterInstalled"
  9. :src="customPosterInstalled"
  10. />
  11. <div class="common-top" v-else>
  12. <img
  13. class="cover"
  14. v-if="isLottaryCpd"
  15. :src="require('../static/svg/img-custom-lottary-bg.svg')"
  16. />
  17. <img
  18. class="cover"
  19. v-else
  20. :src="require('../static/svg/img-custom-common-bg.svg')"
  21. />
  22. <img class="gift" :src="require('../static/svg/icon-gift.gif')" />
  23. <div class="prize">
  24. <font-zoom width="340">
  25. <img
  26. class="icon"
  27. :src="require('../static/svg/icon-gift-inline.svg')"
  28. />
  29. <span class="name" id="custom-name">
  30. {{ customizedReward }}
  31. <span class="total">X{{ totalCount }}</span>
  32. </span>
  33. </font-zoom>
  34. </div>
  35. </div>
  36. <!-- 底部公共模块 -->
  37. <div class="common-bottom" v-if="showBottomInfo">
  38. <div class="theme">
  39. <img
  40. v-if="isLottaryCpd"
  41. class="theme-icon"
  42. :src="require('../static/svg/icon-last-time.svg')"
  43. />
  44. <span v-if="isLottaryCpd" class="theme-time">{{
  45. validity || '00:00:00'
  46. }}</span>
  47. <span class="theme-info">{{
  48. isLottaryCpd ? 'Left' : 'Instant Giveaway'
  49. }}</span>
  50. </div>
  51. <div class="winner-info">
  52. <font-zoom width="340">
  53. <span class="count">{{ totalCount }}Winners</span>
  54. <span>to Share </span>
  55. <span class="prize-name">{{
  56. isMoneyRewardCpd
  57. ? amountValue + ' ' + tokenSymbol
  58. : customizedReward
  59. }}</span>
  60. </font-zoom>
  61. </div>
  62. </div>
  63. </div>
  64. </template>
  65. <script>
  66. import FontZoom from './FontZoom.vue';
  67. import { RewardType, PlayType } from '../types';
  68. export default {
  69. name: 'CustomCardCover',
  70. props: {
  71. totalCount: {
  72. type: Number,
  73. default: 0,
  74. },
  75. amountValue: {
  76. type: Number,
  77. default: 0,
  78. },
  79. tokenSymbol: {
  80. type: String,
  81. default: '',
  82. },
  83. playType: {
  84. type: Number,
  85. default: 1,
  86. },
  87. validityDuration: {
  88. type: String,
  89. default: '',
  90. },
  91. userInfo: {
  92. type: Object,
  93. default: () => {},
  94. },
  95. rewardType: {
  96. type: Number,
  97. default: 1,
  98. },
  99. customizedReward: {
  100. type: String,
  101. default: '',
  102. },
  103. validity: {
  104. type: String,
  105. default: '',
  106. },
  107. showBottomInfo: {
  108. type: Boolean,
  109. default: true,
  110. },
  111. customPosterInstalled: {
  112. type: String,
  113. default: '',
  114. },
  115. posterType: {
  116. type: Number,
  117. default: 1,
  118. },
  119. },
  120. data() {
  121. return {
  122. amount_font_size: 22,
  123. };
  124. },
  125. computed: {
  126. isMoneyRewardCpd() {
  127. return this.rewardType === RewardType.money;
  128. },
  129. isLottaryCpd() {
  130. return this.playType === PlayType.lottery;
  131. },
  132. },
  133. mounted() {
  134. this.setFontSize();
  135. },
  136. methods: {
  137. setFontSize() {
  138. let lendom = document.querySelector('#custom-name');
  139. if (lendom) {
  140. let lenstr = lendom.innerText.length;
  141. let num = parseInt(450 / lenstr);
  142. this.amount_font_size = num < 22 ? num : 22;
  143. }
  144. },
  145. },
  146. components: { FontZoom },
  147. };
  148. </script>
  149. <style scoped lang="scss">
  150. .not-open-custom-card {
  151. width: 100%;
  152. height: 100%;
  153. position: relative;
  154. border-radius: 16px;
  155. filter: drop-shadow(0px 2px 20px rgba(0, 0, 0, 0.1));
  156. .customImg {
  157. width: 100%;
  158. min-height: 373px;
  159. }
  160. .common-top {
  161. position: relative;
  162. }
  163. .money-area {
  164. width: 100%;
  165. position: absolute;
  166. top: 65px;
  167. .txt {
  168. font-weight: 800;
  169. font-size: 16px;
  170. text-align: center;
  171. letter-spacing: 0.3px;
  172. color: #ffffff;
  173. }
  174. .coin {
  175. text-align: center;
  176. width: 100%;
  177. padding: 6px 0;
  178. margin: 0 auto;
  179. display: flex;
  180. align-items: center;
  181. justify-content: center;
  182. img {
  183. width: 46px;
  184. height: 46px;
  185. border-radius: 50%;
  186. border: 3px solid #ffffff;
  187. }
  188. span {
  189. margin-left: 15px;
  190. font-weight: 800;
  191. font-size: 60px;
  192. line-height: 76px;
  193. color: #ffffff;
  194. }
  195. }
  196. .people {
  197. font-weight: 800;
  198. font-size: 13px;
  199. line-height: 16px;
  200. letter-spacing: 0.05em;
  201. color: #ffffff;
  202. display: flex;
  203. align-items: center;
  204. justify-content: center;
  205. }
  206. .time-area {
  207. display: flex;
  208. justify-content: center;
  209. align-items: center;
  210. width: 100%;
  211. height: 46px;
  212. background: rgba(0, 0, 0, 0.15);
  213. color: #ffcc4d;
  214. font-weight: 900;
  215. font-size: 26px;
  216. margin-top: -10px;
  217. .icon-clock {
  218. width: 26px;
  219. height: 26px;
  220. margin-right: 10px;
  221. }
  222. }
  223. }
  224. .title {
  225. position: absolute;
  226. top: 15px;
  227. left: 15px;
  228. z-index: 3;
  229. width: 100%;
  230. display: flex;
  231. align-items: center;
  232. img {
  233. width: 24px;
  234. height: 24px;
  235. border: 2px solid #fff;
  236. border-radius: 50%;
  237. }
  238. span {
  239. margin-left: 10px;
  240. font-weight: 600;
  241. font-size: 16px;
  242. letter-spacing: 0.3px;
  243. color: #fff;
  244. }
  245. }
  246. // .txt {
  247. // width: 100%;
  248. // position: absolute;
  249. // font-style: normal;
  250. // font-weight: 700;
  251. // font-size: 42px;
  252. // line-height: 50px;
  253. // text-align: center;
  254. // color: #FFF2D3;
  255. // top: 90px;
  256. // z-index: 3;
  257. // }
  258. img {
  259. width: 100%;
  260. }
  261. .cover {
  262. border-radius: 16px;
  263. }
  264. .up {
  265. position: absolute;
  266. top: 0;
  267. // box-shadow: 0px 4px 44px rgba(0, 0, 0, 0.1);
  268. z-index: 1;
  269. }
  270. .down {
  271. position: absolute;
  272. top: 253px;
  273. }
  274. .open {
  275. width: 335px;
  276. height: 50px;
  277. cursor: pointer;
  278. position: absolute;
  279. bottom: 28px;
  280. left: 50%;
  281. margin-left: -167.5px;
  282. z-index: 2;
  283. }
  284. .open-gif {
  285. width: 200px;
  286. height: 200px;
  287. text-align: center;
  288. position: absolute;
  289. bottom: 90px;
  290. left: 50%;
  291. margin-left: -100px;
  292. z-index: 3;
  293. }
  294. }
  295. .custom-card {
  296. position: relative;
  297. background: #111214;
  298. width: 100%;
  299. position: relative;
  300. border-radius: 10px;
  301. filter: drop-shadow(0px 2px 20px rgba(0, 0, 0, 0.1));
  302. .cover {
  303. width: 100%;
  304. border-radius: 10px 10px 0 0;
  305. }
  306. .gift {
  307. width: 210px;
  308. position: absolute;
  309. left: 50%;
  310. top: 83px;
  311. transform: translateX(-50%);
  312. }
  313. .prize {
  314. width: 100%;
  315. position: absolute;
  316. top: 76%;
  317. left: 0;
  318. height: 47px;
  319. display: flex;
  320. flex-direction: row;
  321. justify-content: center;
  322. font-style: normal;
  323. font-weight: 800;
  324. font-size: 22px;
  325. line-height: 47px;
  326. letter-spacing: 0.3px;
  327. .icon {
  328. width: 24px;
  329. }
  330. .name {
  331. padding: 0 7px;
  332. color: #fff;
  333. }
  334. .total {
  335. color: #f5c03f;
  336. }
  337. }
  338. .common-bottom {
  339. width: 100%;
  340. height: 62px;
  341. background: #111214;
  342. border-radius: 0 0 10px 10px;
  343. padding: 10px 16px;
  344. font-weight: 500;
  345. font-size: 12px;
  346. line-height: 14px;
  347. letter-spacing: 0.3px;
  348. color: #838383;
  349. line-height: 20px;
  350. .theme {
  351. display: flex;
  352. height: 20px;
  353. align-items: center;
  354. justify-content: flex-start;
  355. &-icon {
  356. width: 12px;
  357. }
  358. &-time {
  359. margin: 0 4px;
  360. color: #1d9bf0;
  361. }
  362. }
  363. .winner-info {
  364. display: flex;
  365. height: 20px;
  366. align-items: center;
  367. justify-content: flex-start;
  368. margin-bottom: 13px;
  369. .count {
  370. color: #1d9bf0;
  371. margin-right: 4px;
  372. }
  373. .prize-name {
  374. color: #1d9bf0;
  375. margin-left: 4px;
  376. }
  377. }
  378. .open-btn {
  379. width: 100%;
  380. height: 45px;
  381. background: linear-gradient(
  382. 180deg,
  383. #4ab6ff 0%,
  384. #1d9bf0 100%,
  385. #1d9bf0 100%
  386. );
  387. border: 1.5px solid rgba(255, 255, 255, 0.15);
  388. border-radius: 52px;
  389. line-height: 45px;
  390. text-align: center;
  391. cursor: pointer;
  392. font-weight: 800;
  393. font-size: 16px;
  394. color: #ffffff;
  395. }
  396. }
  397. }
  398. </style>