| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524 |
- <template>
- <div class="content">
- <!-- open -->
- <div v-if="data.status == 'opened'" class="opened">
- <div class="header">
- <div class="title">Awesome! You Will Get</div>
- <div class="money">
- <img :src="require('../assets/svg/icon-dollar.svg')" alt />
- <span class="big">1.23</span>
- <span class="small">USD</span>
- </div>
- </div>
- <div class="list">
- <div class="item" v-for="item, i in data.list" v-bind:key="i">
- <img :src="item.url" alt />
- <div class="item-content">
- <div class="item-title">{{ item.title }}</div>
- <span>@shasid \!@asd</span>
- </div>
- <div class="btn">{{ item.title }}</div>
- </div>
- </div>
- <div class="people">
- <div class="txt">Total $100 USD,173/1000 People Got</div>
- <div class="right" @click="clickRoad">
- <img :src="require('../assets/svg/icon-dollar.svg')" alt />
- <img :src="require('../assets/svg/icon-dollar.svg')" alt />
- <img :src="require('../assets/svg/icon-dollar.svg')" alt />
- <img :src="require('../assets/svg/icon-right.svg')" alt class="road" />
- </div>
- </div>
- <div class="footer">
- <div class="first">
- <div class="validity">Validity</div>
- <div class="time">23:57:32</div>
- </div>
- <div class="btn" @click="clickGetGiveways">Get Giveaways</div>
- </div>
- </div>
- <!-- success -->
- <div v-if="data.status == 'success'" class="success">
- <div class="header">
- <div class="money">
- <img :src="require('../assets/svg/icon-dollar.svg')" alt />
- <span class="big">1.23</span>
- <span class="small">USD</span>
- </div>
- </div>
- <div class="luck-list-title">
- <div>173/1000 People Got</div>
- <div>Total $100 USD</div>
- </div>
- <div class="luck-list">
- <div class="luck-item" v-for="item,index in data.luck_list" v-bind:key="index">
- <img :src="require('../assets/svg/icon-dollar.svg')" alt />
- <div class="luck-content">
- <div class="luck-title">{{item.title}}</div>
- <div class="luck-time">刚刚</div>
- </div>
- <div class="luck-money">
- <img :src="require('../assets/svg/icon-dollar.svg')" alt />
- <div class="luck-money-txt">123</div>
- </div>
- <div class="luck-king">
- <img :src="require('../assets/svg/icon-king-hat.svg')" alt />
- <span>Luckiest Draw</span>
- </div>
- </div>
- </div>
- </div>
- <!-- no-open -->
- <div v-if="data.status == 'not-open'" class="not-open">
- <img :src="require('../assets/img/up.png')" alt class="up" />
- <img :src="require('../assets/img/down.png')" alt class="down" />
- <div class="open" @click="clickOpenRedPacket">OPEN</div>
- </div>
- <!-- 领取列表 -->
- <div v-if="data.status == 'luck-peopel-list'" class="luck-peopel-list">
- <div class="head">
- <img :src="require('../assets/svg/icon-back.svg')" alt @click="clickBack" />
- </div>
- <div class="luck-list-title">
- <div>173/1000 People Got</div>
- <div>Total $100 USD</div>
- </div>
- <div class="luck-list">
- <div class="luck-item" v-for="item,i in data.luck_list" v-bind:key="i">
- <img :src="require('../assets/svg/icon-dollar.svg')" alt />
- <div class="luck-content">
- <div class="luck-title">{{item}}</div>
- <div class="luck-time">刚刚</div>
- </div>
- <div class="luck-money">
- <img :src="require('../assets/svg/icon-dollar.svg')" alt />
- <div class="luck-money-txt">123</div>
- </div>
- <div class="luck-king">
- <img :src="require('../assets/svg/icon-king-hat.svg')" alt />
- <span>Luckiest Draw</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: 'redPacket',
- }
- </script>
- <script setup>
- import { onMounted, reactive } from "vue";
- import { getPostDetail,getRedPacket} from '../server/redPacket.js'
- let data = reactive({
- status: '',
- list: [
- {
- title: 'Follow',
- url: require('../assets/svg/icon-follow.svg')
- },
- {
- title: 'Like',
- url: require('../assets/svg/icon-like.svg')
- }, {
- title: 'Retweet',
- url: require('../assets/svg/icon-retweet.svg')
- }
- ],
- luck_list: [
- {
- title: 'Retweet',
- url: require('../assets/svg/icon-retweet.svg')
- },
- {
- title: 'Retweet',
- url: require('../assets/svg/icon-retweet.svg')
- }
- ]
- })
- onMounted(()=>{
- getPostDetail().then((res)=>{
- if(res.data.myReceived){
- // 领取了红包
- data.status = 'opened'
- }else{
- data.status = 'not-open'
- }
-
-
- console.log(JSON.parse(res.data.postBizData))
-
- })
- })
- function clickOpenRedPacket() {
- data.status = 'opened'
- getRedPacket().then((res)=>{
-
- })
- }
- function clickGetGiveways() {
- data.status = 'success'
- }
- function clickBack() {
- data.status = 'opened'
- }
- function clickRoad(){
- data.status = 'luck-peopel-list'
- }
- </script>
-
- <style lang="scss">
- html,
- body {
- margin: 0;
- padding: 0;
- }
- .content {
- width: 375px;
- height: 500px;
- background: #fafafa;
- border-radius: 11px;
- font-family: "SF Pro Display";
- font-style: normal;
- .success,
- .luck-peopel-list {
- filter: drop-shadow(0px 4px 94px rgba(0, 0, 0, 0.3));
- width: 100%;
- height: 100%;
- border-radius: 11px;
- background: #fff;
- .head {
- padding: 14px 16px;
- img {
- cursor: pointer;
- width: 24px;
- height: 24px;
- }
- }
- .header {
- text-align: center;
- height: 120px;
- width: 100%;
- background: #ef4545;
- padding-top: 30px;
- .title {
- color: #fff7e4;
- opacity: 0.6;
- font-weight: 700;
- font-size: 18px;
- line-height: 21px;
- letter-spacing: -0.3px;
- }
- .money {
- img {
- width: 40px;
- height: 40px;
- }
- .big {
- font-weight: 700;
- font-size: 46px;
- line-height: 55px;
- /* identical to box height */
- letter-spacing: 0.3px;
- color: #fff8e6;
- }
- .small {
- font-weight: 700;
- font-size: 13px;
- line-height: 16px;
- /* identical to box height */
- letter-spacing: 0.5px;
- color: #fff8e6;
- }
- }
- }
- .luck-list-title {
- padding: 0 16px;
- background: #fff;
- color: #9b9b9b;
- display: flex;
- justify-content: space-between;
- }
- .luck-list {
- background: #fff;
- .luck-item {
- display: flex;
- padding: 12px 16px;
- border-top: 1px solid #d1d1d1;
- justify-content: space-between;
- position: relative;
- .luck-king {
- position: absolute;
- top: 36px;
- right: 16px;
- display: flex;
- align-items: center;
- img {
- width: 22px;
- height: 19px;
- margin: 0;
- }
- span {
- font-weight: 500;
- font-size: 12px;
- line-height: 14px;
- letter-spacing: 0.3px;
- color: #f5b945;
- }
- }
- img {
- width: 42px;
- height: 42px;
- margin-right: 12px;
- }
- .luck-content {
- flex: auto;
- .luck-title {
- font-weight: 500;
- font-size: 16px;
- letter-spacing: 0.3px;
- color: #444444;
- }
- .luck-time {
- font-weight: 400;
- font-size: 12px;
- line-height: 14px;
- color: #9b9b9b;
- }
- }
- .luck-money {
- display: flex;
- height: 17px;
- align-items: center;
- img {
- width: 14px;
- height: 14px;
- margin-right: 6px;
- }
- .luck-money-txt {
- font-weight: 500;
- font-size: 14px;
- /* identical to box height */
- text-align: right;
- letter-spacing: 0.3px;
- color: #444444;
- }
- }
- }
- }
- }
- .opened {
- filter: drop-shadow(0px 4px 94px rgba(0, 0, 0, 0.3));
- width: 100%;
- height: 100%;
- .header {
- text-align: center;
- height: 120px;
- width: 100%;
- background: #ef4545;
- padding-top: 30px;
- .title {
- color: #fff7e4;
- opacity: 0.6;
- font-weight: 700;
- font-size: 18px;
- line-height: 21px;
- letter-spacing: -0.3px;
- }
- .money {
- img {
- width: 40px;
- height: 40px;
- }
- .big {
- font-weight: 700;
- font-size: 46px;
- line-height: 55px;
- /* identical to box height */
- letter-spacing: 0.3px;
- color: #fff8e6;
- }
- .small {
- font-weight: 700;
- font-size: 13px;
- line-height: 16px;
- /* identical to box height */
- letter-spacing: 0.5px;
- color: #fff8e6;
- }
- }
- }
- .list {
- padding: 0 16px 0 16px;
- background: #ffffff;
- .item {
- display: flex;
- align-items: center;
- min-height: 50px;
- border-bottom: 1px solid #f0f0f0;
- img {
- width: 24px;
- height: 24px;
- }
- .item-content {
- flex: 1;
- .item-title {
- font-weight: 500;
- font-size: 16px;
- letter-spacing: 0.3px;
- color: #000000;
- }
- span {
- font-weight: 400;
- font-size: 11px;
- line-height: 13px;
- letter-spacing: 0.3px;
- color: #000000;
- opacity: 0.4;
- }
- }
- .btn {
- width: 72px;
- height: 29px;
- line-height: 29px;
- background: #389aff;
- border-radius: 500px;
- text-align: center;
- letter-spacing: 0.3px;
- color: #ffffff;
- cursor: pointer;
- }
- }
- .item:last-child {
- border: 0;
- }
- }
- .people {
- padding-left: 16px;
- height: 44px;
- line-height: 44px;
- background: #faf9f8;
- box-shadow: 0px 1px 0px #f2f2f2;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .txt {
- font-weight: 400;
- font-size: 12px;
- line-height: 14px;
- letter-spacing: 0.3px;
- color: #000000;
- opacity: 0.4;
- }
- .right {
- cursor: pointer;
- margin-right: 22px;
- display: flex;
- align-items: center;
- img {
- width: 22px;
- height: 22px;
- }
- }
- }
- .footer {
- background: #ffffff;
- display: flex;
- padding: 20px 22px 20px 17px;
- .first {
- flex: 1;
- .validity {
- font-weight: 400;
- font-size: 12px;
- line-height: 14px;
- letter-spacing: 0.3px;
- color: #000000;
- opacity: 0.4;
- margin: 2px 0 8px 0;
- }
- .time {
- font-weight: 500;
- font-size: 13px;
- line-height: 16px;
- /* identical to box height */
- color: #000000;
- }
- }
- .btn {
- background: #ef4545;
- border-radius: 100px;
- color: #fff;
- width: 258px;
- height: 52px;
- font-weight: 600;
- font-size: 18px;
- line-height: 52px;
- text-align: center;
- cursor: pointer;
- }
- }
- }
- .not-open {
- filter: drop-shadow(0px 4px 94px rgba(0, 0, 0, 0.3));
- position: relative;
- img {
- width: 100%;
- }
- .up {
- position: absolute;
- top: 0;
- box-shadow: 0px 4px 44px rgba(0, 0, 0, 0.1);
- z-index: 1;
- }
- .down {
- position: absolute;
- top: 253px;
- }
- .open {
- width: 110px;
- height: 110px;
- text-align: center;
- font-size: 26px;
- font-weight: 600;
- background: #ffe9b5;
- color: #ef4545;
- cursor: pointer;
- border-radius: 50%;
- line-height: 110px;
- position: absolute;
- top: 235px;
- left: 50%;
- margin-left: -55px;
- z-index: 2;
- }
- }
- }
- </style>
|