CustomCardCover.vue 7.1 KB

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