main
significative 5 months ago
parent 07fbbd9995
commit 7e88ee515e
  1. 36
      jeecgboot-vue3-master/src/api/demo/mainHome.ts
  2. 10
      jeecgboot-vue3-master/src/router/routes/mainOut.ts
  3. 7
      jeecgboot-vue3-master/src/views/demo/main-home/components/matchEvaluation/components/LesserCh.vue
  4. 48
      jeecgboot-vue3-master/src/views/demo/main-home/components/matchEvaluation/components/MCh.vue
  5. 52
      jeecgboot-vue3-master/src/views/demo/main-home/index.vue

@ -0,0 +1,36 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
DEMO_NAV_LIST = '/cms/front/getColumnList',
DEMO_ARTICLE_LIST = 'cms/front/getArticleListByColumn'
}
/**
* @description:
*/
export const demoNavListApi = () =>
defHttp.get({
url: Api.DEMO_NAV_LIST,
});
/**
*
* @returns
*/
export const demoArticleListApi = (params:any) =>
defHttp.get({
url: Api.DEMO_ARTICLE_LIST,
params
});
/**
*
* @returns
*/
export const demoArticleApi = (id:string) =>
defHttp.get({
url: Api.DEMO_ARTICLE_LIST,
params:{ id }
});

@ -29,7 +29,7 @@ export const mainOutRoutes: AppRouteModule[] = [
redirect: '/main-home/HomePage', redirect: '/main-home/HomePage',
children: [ children: [
{ {
path: 'HomePage', path: '/main-home/HomePage',
name: 'HomePage', name: 'HomePage',
component: () => import('/@/views/demo/main-home/components/homePage/index.vue'), component: () => import('/@/views/demo/main-home/components/homePage/index.vue'),
meta: { meta: {
@ -38,17 +38,17 @@ export const mainOutRoutes: AppRouteModule[] = [
}, },
}, },
{ {
path: 'MatchEvaluation', path: '/main-home/MatchEvaluation',
name: 'MatchEvaluation', name: 'MatchEvaluation',
component: () => import('/@/views/demo/main-home/components/matchEvaluation/index.vue'), component: () => import('/@/views/demo/main-home/components/matchEvaluation/index.vue'),
meta: { meta: {
title: 'MatchEvaluation', title: 'MatchEvaluation',
ignoreAuth: true, ignoreAuth: true,
}, },
redirect: 'MatchEvaluation/MCh', redirect: '/main-home/MatchEvaluation/MCh',
children: [ children: [
{ {
path: 'MCh', path: '/main-home/MatchEvaluation/MCh',
name: 'MCh', name: 'MCh',
component: () => import('/@/views/demo/main-home/components/matchEvaluation/components/MCh.vue'), component: () => import('/@/views/demo/main-home/components/matchEvaluation/components/MCh.vue'),
meta: { meta: {
@ -57,7 +57,7 @@ export const mainOutRoutes: AppRouteModule[] = [
}, },
}, },
{ {
path: 'LesserCh', path: '/main-home/MatchEvaluation/LesserCh/:id',
name: 'LesserCh', name: 'LesserCh',
component: () => import('/@/views/demo/main-home/components/matchEvaluation/components/LesserCh.vue'), component: () => import('/@/views/demo/main-home/components/matchEvaluation/components/LesserCh.vue'),
meta: { meta: {

@ -23,8 +23,15 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useRoute } from 'vue-router';
import { demoArticleApi } from '/@/api/demo/mainHome';
const route =useRoute()
demoArticleApi(route.params.id as string).then(res => {
console.log("🚀 ~ demoArticleApi ~ res:", res)
})
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.main-content { .main-content {
width: 1345px; width: 1345px;

@ -12,11 +12,14 @@
</div> </div>
<div class="main-content"> <div class="main-content">
<div class="left"> <div class="left">
<div class="card-box-item" v-for="i in 8" :key="i" @click="$router.push('/main-home/MatchEvaluation/LesserCh')"> <div class="card-box-item" v-for="o in data" :key="o.columnId"
@click="$router.push(`/main-home/MatchEvaluation/LesserCh/${o.id}`)">
<div class="card"> <div class="card">
<div class="card_left"></div> <div class="card_left">
</div>
<div class="card_right"> <div class="card_right">
<p class="tit">文本文本文本文本文本文本</p> <p class="tit">{{ o.title }}</p>
<p class="text"> <p class="text">
<span>文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本</span> <span>文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本</span>
</p> </p>
@ -26,8 +29,9 @@
<div class="left_footer"> <div class="left_footer">
<div class="pagination-box"> <div class="pagination-box">
<a-pagination v-model:current="current" v-model:page-size="pageSize" <a-pagination v-model:current="current" v-model:page-size="pageSize"
:page-size-options="['10', '20', '30', '40', '50']" :total="85" :page-size-options="['5','10', '20', '30', '40', '50']" :total="total"
:show-total="total => `共 ${total} 项数据`" show-quick-jumper show-size-changer /> :show-total="total => `共 ${total} 项数据`" @change="pagChange" show-quick-jumper
show-size-changer />
</div> </div>
</div> </div>
</div> </div>
@ -57,11 +61,38 @@
<script setup lang="ts"> <script setup lang="ts">
import { Pagination as APagination, InputSearch as AInputSearch } from 'ant-design-vue'; import { Pagination as APagination, InputSearch as AInputSearch } from 'ant-design-vue';
import { ref } from 'vue'; import { ref, reactive, watch } from 'vue';
import { useRoute } from 'vue-router';
import { demoArticleListApi } from '/@/api/demo/mainHome';
const route = useRoute()
const data = reactive<any[]>([])
//
function getData(columnId: string) {
demoArticleListApi({ columnId: columnId, pageNo: current.value, pageSize: pageSize.value }).then(res => {
data.length = 0
data.push(...res.records as any[])
total.value = res.total
})
}
// //
const current = ref(1); const current = ref(1);
const pageSize = ref(1); const pageSize = ref(10);
const total = ref(0)
function pagChange(page: number, pageSizeP: number) {
current.value = page
pageSize.value = pageSizeP
getData(route.query.id as string)
}
watch(() => route.params.columnId, (newVal: string) => {
if (route.query.id == '1') return
getData(newVal)
}, {
immediate: true
})
// //
const value = ref<string>(''); const value = ref<string>('');
@ -246,7 +277,8 @@ const onSearch = (searchValue: string) => {
position: relative; position: relative;
z-index: 2; z-index: 2;
background-color: #fff; background-color: #fff;
&.black{
&.black {
color: black; color: black;
} }

@ -8,10 +8,9 @@
</div> </div>
<div class="nav-content"> <div class="nav-content">
<div class="nav-box"> <div class="nav-box">
<div class="nav-item" v-for="item in navItems" <div class="nav-item" v-for="item, i in navItems" :class="{ active: acI === i }"
:class="{ active: $route.path.includes(item.path) }" @click="$router.push(item.path)" @click="hanRou(item, i)" :key="item.path">
:key="item.path"> {{ item.name }}
{{ item.title }}
</div> </div>
</div> </div>
<div class="login"> <div class="login">
@ -98,28 +97,43 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref } from 'vue';
import { demoNavListApi } from '/@/api/demo/mainHome';
import { useRouter } from 'vue-router';
const router = useRouter()
type item = { type item = {
title: string, id: string
name: string
path: string path: string
} }
const navItems: item[] = [
const navItems: item[] = reactive([
{ {
title: '首页', id: '1',
name: '首页',
path: '/main-home/HomePage' path: '/main-home/HomePage'
}, },
{ ])
title: '竞赛评价',
demoNavListApi().then(res => {
if (typeof res[Symbol.iterator] !== 'function') return
navItems.length = 1
res.forEach((o: any) => {
navItems.push({
id: o.id,
name: o.name,
path: '/main-home/MatchEvaluation' path: '/main-home/MatchEvaluation'
}, })
{ });
title: '竞赛导航', })
path: '/main-home/...'
}, const acI = ref(0)
{ function hanRou(item: item, i: number) {
title: '研究成果', if (acI.value === i) return
path: '/main-home/...' router.push(item.path+'?id='+item.id)
}, acI.value = i
] }
</script> </script>

Loading…
Cancel
Save