|
@@ -6,17 +6,18 @@
|
|
<div class="gift-record-index__content">
|
|
<div class="gift-record-index__content">
|
|
<el-tabs v-model="activeName" @tab-click="handleClick">
|
|
<el-tabs v-model="activeName" @tab-click="handleClick">
|
|
<el-tab-pane label="我赠送的" name="gift">
|
|
<el-tab-pane label="我赠送的" name="gift">
|
|
- <div v-if="!giftList.length">
|
|
|
|
- <!-- <MyGiftRecord
|
|
|
|
- v-for="(item, index) in giftList"
|
|
|
|
- :key="index"
|
|
|
|
- :item="item"
|
|
|
|
- @click="onClickShare(item)"
|
|
|
|
- /> -->
|
|
|
|
- <MyGiftRecord
|
|
|
|
- @click="onClickShare"
|
|
|
|
- />
|
|
|
|
- <NotifyFriendsDialog :visible="showNotifyFriendsDialog" @update:visible="showNotifyFriendsDialog = false" />
|
|
|
|
|
|
+ <div v-if="giftList.length" class="gift-record-container">
|
|
|
|
+ <vueWaterfallEasy class="gift-water-fall" :gap="20" :img-width="359" :imgs-arr="giftList" @click="clickFn">
|
|
|
|
+ <template slot-scope="props">
|
|
|
|
+ <!-- {{ props }} -->
|
|
|
|
+ <MyGiftRecord
|
|
|
|
+ :key="props.index"
|
|
|
|
+ :item="props.value.info"
|
|
|
|
+ @click="onClickShare"
|
|
|
|
+ />
|
|
|
|
+ </template>
|
|
|
|
+ </vueWaterfallEasy>
|
|
|
|
+ <NotifyFriendsDialog :info="tellInfo" :visible="showNotifyFriendsDialog" @update:visible="showNotifyFriendsDialog = false" />
|
|
</div>
|
|
</div>
|
|
<Empty v-else class="record-container">
|
|
<Empty v-else class="record-container">
|
|
<div>{{ giftEmptyInfo.defaultText }}</div>
|
|
<div>{{ giftEmptyInfo.defaultText }}</div>
|
|
@@ -26,8 +27,12 @@
|
|
</Empty>
|
|
</Empty>
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
<el-tab-pane label="我接收的" name="receive">
|
|
<el-tab-pane label="我接收的" name="receive">
|
|
- <div v-if="receiveList.length">
|
|
|
|
- <MyReceiveRecord />
|
|
|
|
|
|
+ <div v-if="receiveList.length" class="gift-record-container">
|
|
|
|
+ <MyReceiveRecord
|
|
|
|
+ v-for="(item, index) in receiveList"
|
|
|
|
+ :key="index"
|
|
|
|
+ :item="item"
|
|
|
|
+ />
|
|
</div>
|
|
</div>
|
|
<Empty v-else class="record-container">
|
|
<Empty v-else class="record-container">
|
|
<div>{{ receiveEmptyInfo.defaultText }}</div>
|
|
<div>{{ receiveEmptyInfo.defaultText }}</div>
|
|
@@ -40,15 +45,18 @@
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
import { onMounted, reactive, ref } from 'vue'
|
|
import { onMounted, reactive, ref } from 'vue'
|
|
|
|
+import vueWaterfallEasy from 'vue-waterfall-easy'
|
|
import MyGiftRecord from './components/MyGiftRecord.vue'
|
|
import MyGiftRecord from './components/MyGiftRecord.vue'
|
|
import MyReceiveRecord from './components/MyReceiveRecord.vue'
|
|
import MyReceiveRecord from './components/MyReceiveRecord.vue'
|
|
import Empty from '@/components/common/Empty.vue'
|
|
import Empty from '@/components/common/Empty.vue'
|
|
import NotifyFriendsDialog from '@/components/dialog/NotifyFriendsDialog.vue'
|
|
import NotifyFriendsDialog from '@/components/dialog/NotifyFriendsDialog.vue'
|
|
|
|
+import { getGiftRecordList } from '@/api/modules/'
|
|
|
|
|
|
const activeName = ref('gift')
|
|
const activeName = ref('gift')
|
|
const showNotifyFriendsDialog = ref(false)
|
|
const showNotifyFriendsDialog = ref(false)
|
|
const giftList = ref([])
|
|
const giftList = ref([])
|
|
const receiveList = ref([])
|
|
const receiveList = ref([])
|
|
|
|
+const tellInfo = ref({})
|
|
const giftEmptyInfo = reactive({
|
|
const giftEmptyInfo = reactive({
|
|
defaultText: '您当前不是超级订阅用户,需购买后赠送好友。',
|
|
defaultText: '您当前不是超级订阅用户,需购买后赠送好友。',
|
|
buttonText: '去购买'
|
|
buttonText: '去购买'
|
|
@@ -60,12 +68,45 @@ function handleClick(tab, event) {
|
|
console.log(tab, event)
|
|
console.log(tab, event)
|
|
}
|
|
}
|
|
|
|
|
|
-function onClickShare() {
|
|
|
|
|
|
+function onClickShare(data) {
|
|
|
|
+ tellInfo.value = data
|
|
showNotifyFriendsDialog.value = true
|
|
showNotifyFriendsDialog.value = true
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function clickFn(event, { index, value }) {
|
|
|
|
+ // 阻止a标签跳转
|
|
|
|
+ event.preventDefault()
|
|
|
|
+ // 只有当点击到图片时才进行操作
|
|
|
|
+ if (event.target.tagName.toLowerCase() === 'img') {
|
|
|
|
+ console.log('img clicked', index, value)
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+async function getRecordList(type) {
|
|
|
|
+ const params = {
|
|
|
|
+ giftType: type
|
|
|
|
+ }
|
|
|
|
+ const { error_code: code, error_msg: msg, data } = await getGiftRecordList(params)
|
|
|
|
+ if (code === 0) {
|
|
|
|
+ if (type === '1') {
|
|
|
|
+ giftList.value = data.list.map(item => ({
|
|
|
|
+ src: './static/img/1.jpg',
|
|
|
|
+ href: '',
|
|
|
|
+ info: item
|
|
|
|
+ })) || []
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ receiveList.value = data.list || []
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ this.$toast(msg)
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
- console.log('onMounted')
|
|
|
|
|
|
+ getRecordList('1')
|
|
|
|
+ getRecordList('2')
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|
|
|
|
|
|
@@ -80,6 +121,32 @@ onMounted(() => {
|
|
margin-top: 24px;
|
|
margin-top: 24px;
|
|
background: #fff;
|
|
background: #fff;
|
|
border-radius: 8px;
|
|
border-radius: 8px;
|
|
|
|
+ .gift-record-container {
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
+ height: 598px;
|
|
|
|
+ .gift-water-fall {
|
|
|
|
+ ::v-deep {
|
|
|
|
+ .vue-waterfall-easy {
|
|
|
|
+ left: 0!important;
|
|
|
|
+ margin-left: 0!important;
|
|
|
|
+ }
|
|
|
|
+ .img-box {
|
|
|
|
+ padding: 0!important;
|
|
|
|
+ .img-inner-box {
|
|
|
|
+ box-shadow: none;
|
|
|
|
+ border-radius: 0;
|
|
|
|
+ }
|
|
|
|
+ a:focus, a:hover{
|
|
|
|
+ text-decoration: none;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .img-wraper {
|
|
|
|
+ display: none;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
::v-deep {
|
|
::v-deep {
|
|
.el-tabs__header {
|
|
.el-tabs__header {
|
|
margin-bottom: 0;
|
|
margin-bottom: 0;
|
|
@@ -105,6 +172,7 @@ onMounted(() => {
|
|
background-color: #ECECEC;
|
|
background-color: #ECECEC;
|
|
}
|
|
}
|
|
.el-tabs__content {
|
|
.el-tabs__content {
|
|
|
|
+ min-height: 598px;
|
|
padding: 20px 32px;
|
|
padding: 20px 32px;
|
|
}
|
|
}
|
|
}
|
|
}
|