CustomCardCover.vue 8.7 KB

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