|
|
@ -1,6 +1,9 @@ |
|
|
|
<template> |
|
|
|
<PageBanner :layout="layout" :title="`开源版免费下载`" desc="`拥抱开源、坚守品质;致力于打造安全稳定高可用的WEB应用!`" /> |
|
|
|
<CardList :list="list" :disabled="disabled" @done="onSearch" /> |
|
|
|
<PageBanner :layout="layout" :title="`开源版免费下载`" |
|
|
|
:desc="`拥抱开源、坚守品质;致力于打造安全稳定高可用的WEB应用!`"/> |
|
|
|
<div class="text-3xl py-5">{{ count }}</div> |
|
|
|
<el-button @click="increment">点击</el-button> |
|
|
|
<CardList :list="list" :disabled="disabled" @done="onSearch"/> |
|
|
|
</template> |
|
|
|
<script setup lang="ts"> |
|
|
|
import type {ApiResult, PageResult} from "~/api"; |
|
|
@ -10,7 +13,7 @@ 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"; |
|
|
|
|
|
|
|
import { v4 as uuidv4 } from 'uuid'; |
|
|
|
const route = useRoute(); |
|
|
|
|
|
|
|
// 页面信息 |
|
|
@ -31,40 +34,48 @@ const where = reactive<CompanyParam>({ |
|
|
|
}); |
|
|
|
|
|
|
|
const onSearch = () => { |
|
|
|
if(!disabled.value){ |
|
|
|
if (!disabled.value) { |
|
|
|
page.value++; |
|
|
|
reload(route.path); |
|
|
|
} |
|
|
|
} |
|
|
|
const count = useToken() |
|
|
|
|
|
|
|
function increment() { |
|
|
|
count.value = uuidv4() |
|
|
|
} |
|
|
|
|
|
|
|
// 请求数据 |
|
|
|
const reload = async (path: string) => { |
|
|
|
const {data: response} = await useServerRequest<ApiResult<PageResult<CmsProduct>>>('/cms/cms-product/page',{baseURL: runtimeConfig.public.apiServer, params: { |
|
|
|
const {data: response} = await useServerRequest<ApiResult<PageResult<CmsProduct>>>('/cms/cms-product/page', { |
|
|
|
baseURL: runtimeConfig.public.apiServer, params: { |
|
|
|
page: page.value, |
|
|
|
limit: 8, |
|
|
|
price: 0, |
|
|
|
keywords: where.keywords |
|
|
|
}}) |
|
|
|
if(response.value?.data){ |
|
|
|
} |
|
|
|
}) |
|
|
|
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 { |
|
|
|
} else { |
|
|
|
disabled.value = true; |
|
|
|
} |
|
|
|
if(response.value.data.count == 0){ |
|
|
|
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){ |
|
|
|
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){ |
|
|
|
if (form.value?.layout) { |
|
|
|
layout.value = JSON.parse(form.value?.layout) |
|
|
|
} |
|
|
|
|
|
|
@ -80,6 +91,6 @@ watch( |
|
|
|
(path) => { |
|
|
|
reload(path); |
|
|
|
}, |
|
|
|
{ immediate: true } |
|
|
|
{immediate: true} |
|
|
|
); |
|
|
|
</script> |
|
|
|