preview-card.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. <!-- 发布器-预览卡片 -->
  2. <template>
  3. <div class="wrapper">
  4. <div class="card-container">
  5. <!-- 安装之后的卡片样式 -->
  6. <div class="left">
  7. <div class="tips">
  8. <div class="title">
  9. After
  10. </div>
  11. the installs denet
  12. </div>
  13. <div class="head">
  14. <img :src="userInfo.avatarUrl"
  15. class="avatar"/>
  16. <div class="article-wrapper">
  17. <div class="nickname">
  18. {{userInfo.name}}
  19. </div>
  20. <div class="name">
  21. @{{userInfo.nickName}}
  22. </div>
  23. </div>
  24. </div>
  25. <div class="after-cover-wrapper">
  26. <custom-card-cover :data="{
  27. totalCount: baseFormData.totalCount,
  28. amountValue: baseFormData.amountValue,
  29. amountCurrencyCode: 'USD',
  30. currencyIconUrl: require('../../assets/subject/icon-USD.png'),
  31. userInfo: {
  32. nickName: userInfo.name,
  33. avatarUrl: userInfo.avatarUrl
  34. }
  35. }"></custom-card-cover>
  36. </div>
  37. </div>
  38. <!-- 安装之前的卡片样式 -->
  39. <div class="content-before">
  40. <div class="tips">
  41. <div class="title">
  42. Before
  43. </div>
  44. the installs denet
  45. </div>
  46. <div class="head">
  47. <img :src="userInfo.avatarUrl"
  48. class="avatar"/>
  49. <div class="article-wrapper">
  50. <div class="nickname">
  51. {{userInfo.name}}
  52. </div>
  53. <div class="name">
  54. @{{userInfo.nickName}}
  55. </div>
  56. </div>
  57. </div>
  58. <div class="card-wrapper">
  59. <img :src="require('../../assets/subject/img-card-cover-blue.png')"
  60. class="card-cover"/>
  61. <div class="bottom-bar">
  62. <div class="title">
  63. DeNet.me
  64. </div>
  65. <div class="desc">
  66. 🎁 ${{baseFormData.amountValue}} GIVEAWAY
  67. </div>
  68. </div>
  69. <div class="user-info">
  70. <img :src="userInfo.avatarUrl"
  71. class="avatar"/>{{userInfo.name}}
  72. </div>
  73. <div class="content-text">
  74. <div class="title">
  75. USD GIVEAWAY
  76. </div>
  77. <div class="center">
  78. <img src="../../assets/subject/icon-USD.png" class="icon">
  79. {{baseFormData.amountValue}}
  80. </div>
  81. <div class="desc">
  82. {{baseFormData.totalCount}} WINNERS TO SHARE
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. </template>
  90. <script setup>
  91. import { ref, defineProps, onMounted, nextTick } from "vue";
  92. import customCardCover from './custom-card-cover.vue'
  93. import {getChromeStorage} from "../../uilts/chromeExtension"
  94. import {getUser} from "../../http/publishApi"
  95. let userInfo = ref({});
  96. defineProps({
  97. postData: {
  98. type: Object,
  99. default: () => {
  100. return {
  101. }
  102. }
  103. },
  104. baseFormData: {
  105. type: Object,
  106. default: () => {
  107. return {
  108. }
  109. }
  110. }
  111. })
  112. const getUserInfo = (cb) => {
  113. getChromeStorage('userInfo', (res) => {
  114. if(res) {
  115. userInfo.value = res;
  116. }
  117. cb && cb(res);
  118. })
  119. }
  120. const getUserName = (screenName) => {
  121. getUser({
  122. params:{
  123. screenName
  124. }
  125. }).then(res => {
  126. console.log(res);
  127. if(res.code == 0) {
  128. userInfo.value.name = res.data.name || ''
  129. }
  130. });
  131. }
  132. onMounted(() => {
  133. getUserInfo((res) => {
  134. nextTick(() => {
  135. })
  136. if(res) {
  137. getUserName(res.nickName);
  138. }
  139. });
  140. })
  141. </script>
  142. <style lang="scss" scoped>
  143. .wrapper {
  144. width: 100%;
  145. height: 100%;
  146. padding: 10px 16px;
  147. box-sizing: border-box;
  148. border-bottom-right-radius: 16px;
  149. overflow-y: scroll;
  150. padding-bottom: 80px;
  151. display: flex;
  152. &::-webkit-scrollbar {
  153. display: none;
  154. }
  155. .card-container {
  156. width: 100%;
  157. height: fit-content;
  158. background: #ffffff;
  159. box-sizing: border-box;
  160. border-radius: 20px;
  161. padding: 0 16px;
  162. display: flex;
  163. .head {
  164. display: flex;
  165. .avatar {
  166. width: 47px;
  167. height: 47px;
  168. border-radius: 50%;
  169. object-fit: cover;
  170. margin-right: 13px;
  171. }
  172. .article-wrapper {
  173. display: flex;
  174. .nickname {
  175. font-weight: 500;
  176. }
  177. .nickname, .name {
  178. font-size: 15px;
  179. }
  180. .name {
  181. color: #566370;
  182. margin-left: 7px;
  183. }
  184. .desc {
  185. margin-top: 8px;
  186. }
  187. }
  188. }
  189. .left {
  190. width: 430px;
  191. }
  192. .after-cover-wrapper {
  193. position:relative;
  194. width:375px;
  195. margin-left: 53px;
  196. margin-top: -10px;
  197. .icon-gif {
  198. position: absolute;
  199. left: 50%;
  200. bottom: 80px;
  201. transform: translateX(-50%);
  202. width: 160px;
  203. height: 190px;
  204. }
  205. .content-after {
  206. width: 350px;
  207. border-radius: 16px;
  208. display: block;
  209. object-fit: contain;
  210. }
  211. }
  212. .content-before {
  213. width: 550px;
  214. margin-left: 40px;
  215. .card-wrapper {
  216. width: 491px;
  217. border: 1px solid #D1D9DD;
  218. background: #ffffff;
  219. box-sizing: border-box;
  220. overflow: hidden;
  221. position: relative;
  222. box-sizing: border-box;
  223. border-radius: 16px;
  224. margin-left: 60px;
  225. margin-top: -10px;
  226. .user-info {
  227. position: absolute;
  228. left: 15px;
  229. top: 15px;
  230. z-index: 100;
  231. display: flex;
  232. align-items: center;
  233. font-size: 16px;
  234. color: #FFF2D3;
  235. width: max-content;
  236. img {
  237. width: 24px;
  238. height: 24px;
  239. border: 2px solid #FFF4DB;
  240. box-sizing: border-box;
  241. border-radius: 50%;
  242. margin-right: 10px;
  243. }
  244. }
  245. .content-text {
  246. position: absolute;
  247. top: 68px;
  248. left: 35px;
  249. .title {
  250. font-weight: 800;
  251. font-size: 16px;
  252. color: #ffffff;
  253. }
  254. .center {
  255. padding: 12px 0;
  256. box-sizing: border-box;
  257. font-weight: 800;
  258. font-size: 56px;
  259. color: #fff;
  260. display: flex;
  261. align-items: center;
  262. .icon {
  263. width: 46px;
  264. height: 46px;
  265. margin-right: 10px;
  266. border: 3px solid #fff;
  267. border-radius: 50%;
  268. }
  269. }
  270. .desc {
  271. font-weight: 800;
  272. font-size: 13px;
  273. color: #ffffff;
  274. }
  275. }
  276. .card-cover {
  277. width: 100%;
  278. object-fit: contain;
  279. }
  280. .bottom-bar {
  281. padding: 12px;
  282. box-sizing: border-box;
  283. .title {
  284. color: #566370;
  285. font-weight: 400;
  286. font-size: 14px;
  287. margin-bottom: 6px;
  288. }
  289. .desc {
  290. font-weight: 500;
  291. font-size: 15px;
  292. color: #101419;
  293. }
  294. }
  295. }
  296. }
  297. .left, .content-before {
  298. position: relative;
  299. .tips {
  300. position: absolute;
  301. right: 0;
  302. background: #F4F4F4;
  303. border-radius: 6px;
  304. padding: 3px 10px;
  305. font-size: 10px;
  306. color: #4D4D4D;
  307. .title {
  308. font-weight: 500;
  309. font-size: 12px;
  310. color: #000;
  311. }
  312. }
  313. }
  314. }
  315. .select-btn-wrapper {
  316. padding-right: 16px;
  317. box-sizing: border-box;
  318. .title {
  319. font-size: 14px;
  320. margin-bottom: 15px;
  321. }
  322. .select-btn {
  323. margin-bottom: 16px;
  324. box-sizing: border-box;
  325. cursor: pointer;
  326. .icon {
  327. width: 14px;
  328. height: 14px;
  329. margin-right: 8px;
  330. }
  331. .text {
  332. font-size: 14px;
  333. display: flex;
  334. align-items: center;
  335. }
  336. .desc {
  337. white-space: nowrap;
  338. font-weight: 500;
  339. font-size: 13px;
  340. margin-left: 22px;
  341. }
  342. }
  343. .active {
  344. color: #000;
  345. }
  346. }
  347. }
  348. </style>