CustomCardCover.vue 8.4 KB

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