7 changed files with 170 additions and 8 deletions
@ -0,0 +1,52 @@ |
|||||
|
<template> |
||||
|
<div class="md:w-screen-xl m-auto relative sm:flex md:p-0 p-4" v-infinite-scroll="load"> |
||||
|
<el-row :gutter="24" class="flex"> |
||||
|
<template v-for="(item,index) in list" :key="index"> |
||||
|
<el-col :span="6" :xs="24" class="mb-5 min-w-xs"> |
||||
|
<el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer"> |
||||
|
<el-image :src="`${item.image}`" fit="contain" :lazy="true" class="w-full md:h-[150px] h-[199px] cursor-pointer" /> |
||||
|
<div class="flex-1 px-4 py-5 sm:p-6 !p-4"> |
||||
|
<p class="text-gray-700 dark:text-white text-base font-semibold flex flex-col gap-1.5"> |
||||
|
<div class="flex-1 text-xl cursor-pointer">{{ item.title }}</div> |
||||
|
</p> |
||||
|
<p class="flex items-center gap-1.5 py-2 text-gray-500 justify-between"> |
||||
|
<div class="text-gray-500">{{ item.comments }}</div> |
||||
|
</p> |
||||
|
<div class="button-group flex justify-center mt-3"> |
||||
|
<el-button class="w-full" size="large" :icon="ElIconView" @click="openSpmUrl(`/item`, item, item.productId,true)">在线体验</el-button> |
||||
|
<el-button type="primary" size="large" class="w-full" :icon="ElIconShoppingCart">下载源码</el-button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</el-card> |
||||
|
</el-col> |
||||
|
</template> |
||||
|
</el-row> |
||||
|
</div> |
||||
|
<div v-if="disabled" class="px-1 text-center text-gray-500 min-h-xs"> |
||||
|
没有更多了 |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import {openSpmUrl} from "~/utils/common"; |
||||
|
import dayjs from "dayjs"; |
||||
|
import type {CmsProduct} from "~/api/cms/cmsProduct/model"; |
||||
|
|
||||
|
const props = withDefaults( |
||||
|
defineProps<{ |
||||
|
list?: CmsProduct[]; |
||||
|
disabled?: boolean; |
||||
|
}>(), |
||||
|
{} |
||||
|
); |
||||
|
|
||||
|
const emit = defineEmits<{ |
||||
|
(e: 'done'): void; |
||||
|
}>(); |
||||
|
|
||||
|
const load = () => { |
||||
|
if(!props.disabled){ |
||||
|
emit('done') |
||||
|
} |
||||
|
} |
||||
|
</script> |
@ -0,0 +1,85 @@ |
|||||
|
<template> |
||||
|
<PageBanner :layout="layout" :title="`开源版免费下载`" desc="`拥抱开源、坚守品质;致力于打造安全稳定高可用的WEB应用!`" /> |
||||
|
<CardList :list="list" :disabled="disabled" @done="onSearch" /> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import type {ApiResult, PageResult} from "~/api"; |
||||
|
import {useServerRequest} from "~/composables/useServerRequest"; |
||||
|
import {useWebsite} from "~/composables/configState"; |
||||
|
import type {Navigation} from "~/api/cms/navigation/model"; |
||||
|
import type {CompanyParam} from "~/api/system/company/model"; |
||||
|
import CardList from './components/CardList.vue'; |
||||
|
import type {CmsProduct} from "~/api/cms/cmsProduct/model"; |
||||
|
|
||||
|
const route = useRoute(); |
||||
|
|
||||
|
// 页面信息 |
||||
|
const runtimeConfig = useRuntimeConfig(); |
||||
|
const list = ref<CmsProduct[]>([]); |
||||
|
const page = ref<number>(1); |
||||
|
const resultText = ref(''); |
||||
|
const layout = ref<any>(); |
||||
|
const disabled = ref<boolean>(false); |
||||
|
|
||||
|
// 获取状态 |
||||
|
const form = ref<Navigation>(); |
||||
|
const website = useWebsite(); |
||||
|
|
||||
|
// 搜索表单 |
||||
|
const where = reactive<CompanyParam>({ |
||||
|
keywords: '' |
||||
|
}); |
||||
|
|
||||
|
const onSearch = () => { |
||||
|
if(!disabled.value){ |
||||
|
page.value++; |
||||
|
reload(route.path); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 请求数据 |
||||
|
const reload = async (path: string) => { |
||||
|
const {data: response} = await useServerRequest<ApiResult<PageResult<CmsProduct>>>('/cms/cms-product/page',{baseURL: runtimeConfig.public.apiServer, params: { |
||||
|
page: page.value, |
||||
|
limit: 8, |
||||
|
keywords: where.keywords |
||||
|
}}) |
||||
|
if(response.value?.data){ |
||||
|
if (list.value.length < response.value?.data.count) { |
||||
|
disabled.value = false; |
||||
|
if (response.value?.data.list) { |
||||
|
list.value = list.value.concat(response.value?.data.list); |
||||
|
} |
||||
|
}else { |
||||
|
disabled.value = true; |
||||
|
} |
||||
|
if(response.value.data.count == 0){ |
||||
|
resultText.value = '暂无相关结果' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
const { data: nav } = await useServerRequest<ApiResult<Navigation>>('/cms/cms-navigation/getNavigationByPath',{query: {path: route.path}}) |
||||
|
if(nav.value?.data){ |
||||
|
form.value = nav.value?.data; |
||||
|
} |
||||
|
// 页面布局 |
||||
|
if(form.value?.layout){ |
||||
|
layout.value = JSON.parse(form.value?.layout) |
||||
|
} |
||||
|
|
||||
|
useHead({ |
||||
|
title: `产品 - ${website.value.websiteName}`, |
||||
|
bodyAttrs: { |
||||
|
class: "page-container", |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
watch( |
||||
|
() => route.path, |
||||
|
(path) => { |
||||
|
reload(path); |
||||
|
}, |
||||
|
{ immediate: true } |
||||
|
); |
||||
|
</script> |
Loading…
Reference in new issue