Commit 2f75a948899713e10b200e0f39a48d4b62ef231e

Authored by 陈小婷
1 parent e8ccdc7f

feat: add basic-list page

src/router/menus/modules/demo/page.ts
@@ -106,6 +106,10 @@ const menu: MenuModule = { @@ -106,6 +106,10 @@ const menu: MenuModule = {
106 }, 106 },
107 children: [ 107 children: [
108 { 108 {
  109 + path: 'basic',
  110 + name: '标准列表',
  111 + },
  112 + {
109 path: 'card', 113 path: 'card',
110 name: 'routes.demo.page.listCard', 114 name: 'routes.demo.page.listCard',
111 }, 115 },
src/router/routes/modules/demo/page.ts
@@ -219,6 +219,14 @@ const page: AppRouteModule = { @@ -219,6 +219,14 @@ const page: AppRouteModule = {
219 }, 219 },
220 children: [ 220 children: [
221 { 221 {
  222 + path: 'basic',
  223 + name: 'ListBasicPage',
  224 + component: () => import('/@/views/demo/page/list/basic/index.vue'),
  225 + meta: {
  226 + title: '标准列表',
  227 + },
  228 + },
  229 + {
222 path: 'card', 230 path: 'card',
223 name: 'ListCardPage', 231 name: 'ListCardPage',
224 component: () => import('/@/views/demo/page/list/card/index.vue'), 232 component: () => import('/@/views/demo/page/list/card/index.vue'),
src/views/demo/page/list/basic/data.tsx 0 → 100644
  1 +export const cardList = (() => {
  2 + const result: any[] = [];
  3 + for (let i = 0; i < 6; i++) {
  4 + result.push({
  5 + id: i,
  6 + title: 'Vben Admin',
  7 + description: '基于Vue Next, TypeScript, Ant Design Vue实现的一套完整的企业级后台管理系统',
  8 + datetime: '2020-11-26 17:39',
  9 + extra: '编辑',
  10 + icon: 'logos:vue',
  11 + color: '#1890ff',
  12 + author: 'Vben',
  13 + percent: 20 * (i + 1),
  14 + });
  15 + }
  16 + return result;
  17 +})();
src/views/demo/page/list/basic/index.vue 0 → 100644
  1 +<template>
  2 + <div :class="prefixCls">
  3 + <a-page-header title="标准列表" :ghost="false" />
  4 + <div :class="`${prefixCls}__top`">
  5 + <a-row :gutter="12">
  6 + <a-col :span="8" :class="`${prefixCls}__top-col`">
  7 + <div>我的待办</div>
  8 + <p>8个任务</p>
  9 + </a-col>
  10 + <a-col :span="8" :class="`${prefixCls}__top-col`">
  11 + <div>本周任务平均处理时间</div>
  12 + <p>32分钟</p>
  13 + </a-col>
  14 + <a-col :span="8" :class="`${prefixCls}__top-col`">
  15 + <div>本周完成任务数</div>
  16 + <p>24个任务</p>
  17 + </a-col>
  18 + </a-row>
  19 + </div>
  20 +
  21 + <div :class="`${prefixCls}__content`">
  22 + <a-list :pagination="pagination">
  23 + <template v-for="item in list" :key="item.id">
  24 + <a-list-item class="list">
  25 + <a-list-item-meta>
  26 + <template #avatar>
  27 + <Icon class="icon" v-if="item.icon" :icon="item.icon" :color="item.color" />
  28 + </template>
  29 + <template #title>
  30 + <span>{{ item.title }}</span>
  31 + <div class="extra" v-if="item.extra">
  32 + {{ item.extra }}
  33 + </div>
  34 + </template>
  35 + <template #description>
  36 + <div class="description">{{ item.description }}</div>
  37 + <div class="info">
  38 + <div><span>Owner</span>{{ item.author }}</div>
  39 + <div><span>开始时间</span>{{ item.datetime }}</div>
  40 + </div>
  41 + <div class="progress">
  42 + <Progress :percent="item.percent" status="active" />
  43 + </div>
  44 + </template>
  45 + </a-list-item-meta>
  46 + </a-list-item>
  47 + </template>
  48 + </a-list>
  49 + </div>
  50 + </div>
  51 +</template>
  52 +<script lang="ts">
  53 + import { Progress } from 'ant-design-vue';
  54 + import { defineComponent } from 'vue';
  55 + import Icon from '/@/components/Icon/index';
  56 + import { cardList } from './data';
  57 +
  58 + export default defineComponent({
  59 + components: { Icon, Progress },
  60 + setup() {
  61 + return {
  62 + prefixCls: 'list-basic',
  63 + list: cardList,
  64 + pagination: {
  65 + show: true,
  66 + pageSize: 3,
  67 + },
  68 + };
  69 + },
  70 + });
  71 +</script>
  72 +<style lang="less" scoped>
  73 + .list-basic {
  74 + &__top {
  75 + padding: 24px;
  76 + margin: 24px 24px 0 24px;
  77 + text-align: center;
  78 + background: #fff;
  79 +
  80 + &-col {
  81 + &:not(:last-child) {
  82 + border-right: 1px dashed rgba(206, 206, 206, 0.4);
  83 + }
  84 +
  85 + div {
  86 + margin-bottom: 12px;
  87 + font-size: 14px;
  88 + line-height: 22px;
  89 + color: rgba(0, 0, 0, 0.45);
  90 + }
  91 +
  92 + p {
  93 + margin: 0;
  94 + font-size: 24px;
  95 + line-height: 32px;
  96 + color: rgba(0, 0, 0, 0.85);
  97 + }
  98 + }
  99 + }
  100 +
  101 + &__content {
  102 + padding: 24px;
  103 + margin: 12px 24px;
  104 + background: #fff;
  105 +
  106 + .list {
  107 + position: relative;
  108 + }
  109 +
  110 + .icon {
  111 + font-size: 40px !important;
  112 + }
  113 +
  114 + .extra {
  115 + position: absolute;
  116 + top: 20px;
  117 + right: 15px;
  118 + font-weight: normal;
  119 + color: #1890ff;
  120 + cursor: pointer;
  121 + }
  122 +
  123 + .description {
  124 + display: inline-block;
  125 + width: 40%;
  126 + }
  127 +
  128 + .info {
  129 + display: inline-block;
  130 + width: 30%;
  131 + text-align: center;
  132 +
  133 + div {
  134 + display: inline-block;
  135 + padding: 0 20px;
  136 +
  137 + span {
  138 + display: block;
  139 + }
  140 + }
  141 + }
  142 +
  143 + .progress {
  144 + display: inline-block;
  145 + width: 15%;
  146 + vertical-align: top;
  147 + }
  148 + }
  149 + }
  150 +</style>