|
@@ -1,71 +1,134 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
- <div class="list">
|
|
|
- <div class="item">
|
|
|
- <div class="left">
|
|
|
- <img :src="require('@/assets/svg/icon-btn-box.svg')" alt="" />
|
|
|
- </div>
|
|
|
- <div class="right">
|
|
|
- <div>@Ambrose1283</div>
|
|
|
- <div>3 min ago</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="item">
|
|
|
+ <div class="content">
|
|
|
+ <div class="error" v-if="state.invited_list.length == 0">
|
|
|
+ Invite people to hunt treasure with you!
|
|
|
+ </div>
|
|
|
+ <div class="list" v-else>
|
|
|
+ <div class="item" v-for="item in state.invited_list">
|
|
|
<div class="left">
|
|
|
<img :src="require('@/assets/svg/icon-btn-box.svg')" alt="" />
|
|
|
</div>
|
|
|
<div class="right">
|
|
|
- <div>@Ambrose1283</div>
|
|
|
- <div>3 min ago</div>
|
|
|
+ <div>{{ item.userInfo.nickName }}</div>
|
|
|
+ <div>{{ getTime(item.timestamp) }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <v-btn :txt="'Invite a friend to open the chest'" :font-size="'17px'" class="btn" :icon="false"
|
|
|
- :disabled="true"></v-btn>
|
|
|
+ <div class="footer">
|
|
|
+ <v-btn :txt="'Invite a friend to open the chest'" :font-size="'17px'" class="btn" :icon="false"
|
|
|
+ :disabled="false" @onClick="clickBtn"></v-btn>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script setup>
|
|
|
-import { reactive } from 'vue'
|
|
|
import VBtn from '@/view/iframe/treasure-hunt/components/btn.vue'
|
|
|
+import OpenBox from '@/view/iframe/treasure-hunt/components/dialog.vue'
|
|
|
+import { inject } from 'vue'
|
|
|
+
|
|
|
+var moment = require('moment')
|
|
|
+let state = inject('state')
|
|
|
+state.invited_list = [
|
|
|
+ {
|
|
|
+ timestamp: 1659690839454,
|
|
|
+ userInfo: {
|
|
|
+ avatarUrl: '',
|
|
|
+ nickName: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+]
|
|
|
+
|
|
|
+const getTime = (timestamp) => {
|
|
|
+ let _d1 = moment(new Date().getTime())
|
|
|
+ let _d2 = moment(timestamp)
|
|
|
+ const plural = (n, s) => {
|
|
|
+ let _str = `${n} ${s} ago`
|
|
|
+ if (n > 1) {
|
|
|
+ _str = `${n} ${s}s ago`
|
|
|
+ }
|
|
|
+ return _str
|
|
|
+ }
|
|
|
+ let _d = moment.duration(_d1.diff(_d2)).days()
|
|
|
+ if (_d) {
|
|
|
+ return plural(_d, 'day')
|
|
|
+ }
|
|
|
+ let _h = moment.duration(_d1.diff(_d2)).hours()
|
|
|
+ if (_h) {
|
|
|
+ return plural(_h, 'hour')
|
|
|
+ }
|
|
|
+ let _m = moment.duration(_d1.diff(_d2)).minutes()
|
|
|
+ if (_m) {
|
|
|
+ return plural(_m, 'min')
|
|
|
+ }
|
|
|
+ let _s = moment.duration(_d1.diff(_d2)).seconds()
|
|
|
+ return plural(_s, 'sec')
|
|
|
+}
|
|
|
+
|
|
|
+const clickBtn = () => {
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
-.list {
|
|
|
- .item {
|
|
|
- height: 60px;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
-
|
|
|
- .left {
|
|
|
- width: 58px;
|
|
|
- text-align: center;
|
|
|
-
|
|
|
- img {
|
|
|
- width: 30px;
|
|
|
- height: 30px;
|
|
|
- }
|
|
|
- }
|
|
|
+.content {
|
|
|
+ position: relative;
|
|
|
+ height: 292px;
|
|
|
+
|
|
|
+ .footer {
|
|
|
+ background: #fff;
|
|
|
+ padding: 10px 16px 25px 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .error {
|
|
|
+ height: 204px;
|
|
|
+ color: #BABABA;
|
|
|
+ font-weight: 500;
|
|
|
+ font-size: 15px;
|
|
|
+ line-height: 204px;
|
|
|
+ text-align: center;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- .right {
|
|
|
- flex: 1;
|
|
|
- border-bottom: 1px solid #D9D9D9;
|
|
|
+ .list {
|
|
|
+ height: 204px;
|
|
|
+ overflow-y: auto;
|
|
|
+
|
|
|
+ .item {
|
|
|
+ height: 60px;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- height: 100%;
|
|
|
- justify-content: space-between;
|
|
|
|
|
|
- div:nth-child(1) {
|
|
|
- color: #000000;
|
|
|
- font-weight: 500;
|
|
|
- font-size: 15px;
|
|
|
+ .left {
|
|
|
+ width: 58px;
|
|
|
+ text-align: center;
|
|
|
|
|
|
+ img {
|
|
|
+ width: 30px;
|
|
|
+ height: 30px;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- div:nth-child(2) {
|
|
|
- color: #A6A6A6;
|
|
|
- font-weight: 400;
|
|
|
- font-size: 12px;
|
|
|
- margin-right: 17px;
|
|
|
+ .right {
|
|
|
+ flex: 1;
|
|
|
+ border-bottom: 1px solid #D9D9D9;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ height: 100%;
|
|
|
+ justify-content: space-between;
|
|
|
+
|
|
|
+ div:nth-child(1) {
|
|
|
+ color: #000000;
|
|
|
+ font-weight: 500;
|
|
|
+ font-size: 15px;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ div:nth-child(2) {
|
|
|
+ color: #A6A6A6;
|
|
|
+ font-weight: 400;
|
|
|
+ font-size: 12px;
|
|
|
+ margin-right: 17px;
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|