|
@@ -13,8 +13,10 @@ const data = ref([] as DynamicType[])
|
|
const searchParames = ref({
|
|
const searchParames = ref({
|
|
pageNum: 0,
|
|
pageNum: 0,
|
|
pageSize: 0,
|
|
pageSize: 0,
|
|
- searchKey: ''
|
|
|
|
|
|
+ searchKey: '',
|
|
|
|
+ dictId: null
|
|
} as {
|
|
} as {
|
|
|
|
+ dictId: number | null,
|
|
pageNum: number,
|
|
pageNum: number,
|
|
pageSize: number,
|
|
pageSize: number,
|
|
searchKey: string
|
|
searchKey: string
|
|
@@ -44,15 +46,39 @@ const goDetai = (id: number) => {
|
|
router.push({ name: 'dynamicDetail', params: { id } });
|
|
router.push({ name: 'dynamicDetail', params: { id } });
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const getTypeList = async () => {
|
|
|
|
+ // 获取珍藏类型
|
|
|
|
+ const resType: any = await DynamicApi.getTypeList()
|
|
|
|
+ if (resType.code == 0) {
|
|
|
|
+ typeList.value = resType.data
|
|
|
|
+ typeList.value.unshift({
|
|
|
|
+ createTime: null,
|
|
|
|
+ creatorId: null,
|
|
|
|
+ creatorName: '',
|
|
|
|
+ display: null,
|
|
|
|
+ id: null,
|
|
|
|
+ name: '全部',
|
|
|
|
+ parentId: null,
|
|
|
|
+ rtf: '',
|
|
|
|
+ sort: null,
|
|
|
|
+ type: '',
|
|
|
|
+ typeKey: '',
|
|
|
|
+ updateTime: null
|
|
|
|
+ })
|
|
|
|
+ console.log(typeList.value)
|
|
|
|
+ } else {
|
|
|
|
+ showToast(resType.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ getList()
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
const getList = async () => {
|
|
const getList = async () => {
|
|
|
|
+ searchParames.value.dictId = active.value == 0 ? null : typeList.value[active.value].id!
|
|
const res: any = await DynamicApi.getDynamicList(searchParames.value)
|
|
const res: any = await DynamicApi.getDynamicList(searchParames.value)
|
|
if (res.code == 0) {
|
|
if (res.code == 0) {
|
|
allData.value = res.data.records
|
|
allData.value = res.data.records
|
|
- const types = res.data.records.map((item: any) => {
|
|
|
|
- return item.type
|
|
|
|
- })
|
|
|
|
- typeList.value = [...new Set(types)]
|
|
|
|
- typeList.value.unshift('全部')
|
|
|
|
data.value = allData.value
|
|
data.value = allData.value
|
|
} else {
|
|
} else {
|
|
showToast(res.msg)
|
|
showToast(res.msg)
|
|
@@ -60,18 +86,11 @@ const getList = async () => {
|
|
}
|
|
}
|
|
|
|
|
|
watch(active, () => {
|
|
watch(active, () => {
|
|
- if (active.value == 0) {
|
|
|
|
- data.value = allData.value
|
|
|
|
- } else {
|
|
|
|
- data.value = allData.value.filter((item: any) => {
|
|
|
|
- return item.type == typeList.value[active.value]
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ getList()
|
|
})
|
|
})
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
- getList()
|
|
|
|
|
|
+ getTypeList()
|
|
})
|
|
})
|
|
|
|
|
|
</script>
|
|
</script>
|
|
@@ -80,11 +99,11 @@ onMounted(() => {
|
|
<div class='dynamic'>
|
|
<div class='dynamic'>
|
|
|
|
|
|
<div class="tabs">
|
|
<div class="tabs">
|
|
- <div class="tab-item" :class="{ active: index === active }" v-for="(item, index) in typeList" :key="item"
|
|
|
|
- @click="active = index">{{ item }}</div>
|
|
|
|
|
|
+ <div class="tab-item" :class="{ active: index === active }" v-for="(item, index) in typeList" :key="item.id"
|
|
|
|
+ @click="active = index">{{ item.name }}</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- <div class="tab-content">
|
|
|
|
|
|
+ <div class="tab-content" v-if="data.length > 0">
|
|
<div class="activity-card" v-for="(item, index) in data" :key="index" @click="goDetai(item.id)">
|
|
<div class="activity-card" v-for="(item, index) in data" :key="index" @click="goDetai(item.id)">
|
|
<img v-show="item.thumb != ''" class="thumb" :src="item.thumb" alt="">
|
|
<img v-show="item.thumb != ''" class="thumb" :src="item.thumb" alt="">
|
|
<div class="title">{{ item.name }}</div>
|
|
<div class="title">{{ item.name }}</div>
|
|
@@ -94,7 +113,12 @@ onMounted(() => {
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <div class="no-data" v-else>
|
|
|
|
+ <img src="@/assets/images/no-data.png" alt="">
|
|
|
|
+ <div class="tips">暂时没有数据 ,请试一下其他关键字</div>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<style lang='less' scoped>
|
|
<style lang='less' scoped>
|
|
@@ -116,11 +140,15 @@ onMounted(() => {
|
|
// height: 40px;
|
|
// height: 40px;
|
|
white-space: nowrap;
|
|
white-space: nowrap;
|
|
overflow-x: auto;
|
|
overflow-x: auto;
|
|
- padding: 15px 10px 10px 0px;
|
|
|
|
|
|
+ padding: 15px 10px 5px 0px;
|
|
|
|
+ // padding-top: 10px;
|
|
|
|
+
|
|
|
|
+ margin: 0 10px;
|
|
|
|
+
|
|
font-family: 'SourceHanSansCN-Regular';
|
|
font-family: 'SourceHanSansCN-Regular';
|
|
|
|
|
|
&::-webkit-scrollbar {
|
|
&::-webkit-scrollbar {
|
|
- display: none;
|
|
|
|
|
|
+ height: 0px
|
|
/* 或 width: 0; */
|
|
/* 或 width: 0; */
|
|
}
|
|
}
|
|
|
|
|
|
@@ -187,6 +215,12 @@ onMounted(() => {
|
|
font-family: 'SourceHanSansCN-Regular';
|
|
font-family: 'SourceHanSansCN-Regular';
|
|
margin-bottom: 5px;
|
|
margin-bottom: 5px;
|
|
|
|
|
|
|
|
+ display: -webkit-box;
|
|
|
|
+ -webkit-box-orient: vertical;
|
|
|
|
+ -webkit-line-clamp: 2;
|
|
|
|
+ line-clamp: 2;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
.time {
|
|
.time {
|
|
@@ -202,6 +236,28 @@ onMounted(() => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ .no-data {
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: calc(100% - 7vh);
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-direction: column;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ align-items: center;
|
|
|
|
+ margin-top: 10%;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ img {
|
|
|
|
+ width: 40%;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .tips {
|
|
|
|
+ color: #88866F;
|
|
|
|
+ margin-top: 10px;
|
|
|
|
+ font-family: 'SourceHanSansCN-Regular';
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|