基于Java spring + vue3 + nuxt构建的内容管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

75 lines
1.9 KiB

<template>
<PageBanner :layout="layout" :title="`${form?.categoryName}`" :desc="`${form?.comments}`" />
<CardList :param="{type: 0,official: true}" :data="data" :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 {Company, CompanyParam} from "~/api/system/company/model";
import CardList from './components/CardList.vue';
import {getIdBySpm} from "~/utils/common";
const route = useRoute();
// 页面信息
const runtimeConfig = useRuntimeConfig();
const data = ref<PageResult<Company>>();
const page = ref<number>(0);
const resultText = ref('');
const layout = ref<any>();
const disabled = ref<boolean>(false);
// 获取状态
const form = ref<Navigation>();
// 搜索表单
const where = reactive<CompanyParam>({
keywords: ''
});
const onSearch = (index: number) => {
page.value = index;
reload();
}
// 请求数据
const reload = async () => {
const {data: response} = await useServerRequest<ApiResult<PageResult<Company>>>('/system/company/page',{baseURL: runtimeConfig.public.apiServer, params: {
page: page.value,
limit: 12,
categoryId: getIdBySpm(5),
keywords: where.keywords
}})
if(response.value?.data){
data.value = response.value?.data;
}
}
const { data: nav } = await useServerRequest<ApiResult<Navigation>>(`/cms/cms-navigation/${getIdBySpm(5)}`)
if(nav.value?.data){
form.value = nav.value?.data;
useHead({
title: `${form.value.title} - WEBSOFT`,
bodyAttrs: {
class: "page-container",
}
});
}
// 页面布局
if(form.value?.layout){
layout.value = JSON.parse(form.value?.layout)
}
watch(
() => getIdBySpm(5),
(id) => {
console.log(id,'id = .>>>>')
reload();
},
{ immediate: true }
);
</script>