Commit 86588f33 by Sendya

Fixed bug

Added CardList
parent 65970af1
<template> <template>
<layout-main> <layout-main>
<route-view/> <page-view />
</layout-main> </layout-main>
</template> </template>
<script> <script>
import LayoutMain from './LayoutMain' import LayoutMain from './LayoutMain'
import RouteView from './RouteView' import PageView from './PageView'
export default { export default {
name: "GlobalView", name: "GlobalView",
components: { components: {
LayoutMain, LayoutMain,
RouteView PageView
} }
} }
</script> </script>
......
...@@ -135,7 +135,9 @@ ...@@ -135,7 +135,9 @@
line-height: 28px; line-height: 28px;
font-weight: 500; font-weight: 500;
color: rgba(0,0,0,.85); color: rgba(0,0,0,.85);
margin-bottom: 12px; margin-bottom: 16px;
flex: auto;
} }
.logo { .logo {
width: 28px; width: 28px;
...@@ -160,6 +162,9 @@ ...@@ -160,6 +162,9 @@
min-width: 266px; min-width: 266px;
flex: 0 1 auto; flex: 0 1 auto;
text-align: right; text-align: right;
&:empty {
display: none;
}
} }
} }
} }
......
...@@ -5,18 +5,18 @@ ...@@ -5,18 +5,18 @@
<slot slot="action" name="action"></slot> <slot slot="action" name="action"></slot>
<slot slot="content" name="headerContent"></slot> <slot slot="content" name="headerContent"></slot>
<div slot="content" v-if="!this.$slots.headerContent && desc"> <div slot="content" v-if="!this.$slots.headerContent && desc">
<p style="font-size: 14px;line-height: 1.5;color: rgba(0,0,0,.65)">{{ desc }}</p> <p style="font-size: 14px;color: rgba(0,0,0,.65)">{{ desc }}</p>
<div class="link"> <div class="link">
<template v-for="(link, index) in linkList"> <template v-for="(link, index) in linkList">
<a :key="index" :href="link.href"> <a :key="index" :href="link.href">
<a-icon :type="link.icon" />{{ link.title }} <a-icon :type="link.icon" /><span>{{ link.title }}</span>
</a> </a>
</template> </template>
</div> </div>
</div> </div>
<slot slot="extra" name="extra"></slot> <slot slot="extra" name="extra"></slot>
</page-header> </page-header>
<div ref="content" class="content"> <div class="content">
<slot></slot> <slot></slot>
</div> </div>
</div> </div>
...@@ -34,8 +34,31 @@ ...@@ -34,8 +34,31 @@
} }
</script> </script>
<style scoped> <style lang="scss" scoped>
.content { .content {
margin: 24px 24px 0; margin: 24px 24px 0;
.link {
margin-top: 16px;
a {
margin-right: 32px;
height: 24px;
line-height: 24px;
display: inline-block;
i {
font-size: 24px;
margin-right: 8px;
vertical-align: middle;
}
span {
height: 24px;
line-height: 24px;
display: inline-block;
vertical-align: middle;
}
}
}
} }
</style> </style>
\ No newline at end of file
<template> <template>
<page-layout :desc="desc" :title="getTitle" :link-list="linkList"> <page-layout :desc="description" :title="getTitle" :link-list="linkList">
<div slot="extra" class="extra-img"> <div slot="extra" class="extra-img">
<img :src="extraImage"/> <img :src="extraImage"/>
</div> </div>
<!-- keep-alive --> <!-- keep-alive -->
<route-view></route-view> <route-view ref="content"></route-view>
</page-layout> </page-layout>
</template> </template>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
data () { data () {
return { return {
title: '', title: '',
desc: '', description: '',
linkList: [], linkList: [],
extraImage: '' extraImage: ''
} }
...@@ -42,12 +42,11 @@ ...@@ -42,12 +42,11 @@
methods: { methods: {
getPageHeaderInfo () { getPageHeaderInfo () {
// eslint-disable-next-line // eslint-disable-next-line
console.log('route title:', this.$route.meta.title)
this.title = this.$route.meta.title this.title = this.$route.meta.title
const content = this.$refs.content // 因为套用了一层 route-view 所以要取 ref 对象下的子节点的第一个对象
const content = this.$refs.content.$children[0]
if (content) { if (content) {
this.desc = content.desc this.description = content.description
this.linkList = content.linkList this.linkList = content.linkList
this.extraImage = content.extraImage this.extraImage = content.extraImage
} }
......
...@@ -47,7 +47,7 @@ export const asyncRouterMap = [ ...@@ -47,7 +47,7 @@ export const asyncRouterMap = [
path: '/dashboard', path: '/dashboard',
component: Layout, component: Layout,
name: 'dashboard', name: 'dashboard',
redirect: '/dashboard/analysis', redirect: '/dashboard/workplace',
meta: { title: '仪表盘', icon: 'dashboard' }, meta: { title: '仪表盘', icon: 'dashboard' },
children: [ children: [
{ {
...@@ -102,7 +102,6 @@ export const asyncRouterMap = [ ...@@ -102,7 +102,6 @@ export const asyncRouterMap = [
component: LayoutBase, component: LayoutBase,
name: 'list', name: 'list',
redirect: '/list/query-list', redirect: '/list/query-list',
hidden: true,
meta: { title: '列表页', icon: 'table' }, meta: { title: '列表页', icon: 'table' },
children: [ children: [
{ {
...@@ -120,7 +119,7 @@ export const asyncRouterMap = [ ...@@ -120,7 +119,7 @@ export const asyncRouterMap = [
{ {
path: '/list/card', path: '/list/card',
name: 'CardList', name: 'CardList',
component: () => import('../views/list/TableList'), component: () => import('../views/list/CardList'),
meta: { title: '卡片列表' } meta: { title: '卡片列表' }
}, },
{ {
......
...@@ -47,8 +47,13 @@ ...@@ -47,8 +47,13 @@
<a-list-item :key="index" v-for="(item, index) in activities"> <a-list-item :key="index" v-for="(item, index) in activities">
<a-list-item-meta> <a-list-item-meta>
<a-avatar slot="avatar" :src="item.user.avatar" /> <a-avatar slot="avatar" :src="item.user.avatar" />
<div slot="title" v-html="item.template" /> <div slot="title">
<div slot="description">9小时前</div> <span>{{ item.user.nickname }}</span>&nbsp;
&nbsp;<a href="#">{{ item.project.name }}</a>&nbsp;
<span>{{ item.project.action }}</span>&nbsp;
<a href="#">{{ item.project.event }}</a>
</div>
<div slot="description">{{ item.time }}</div>
</a-list-item-meta> </a-list-item-meta>
</a-list-item> </a-list-item>
</a-list> </a-list>
...@@ -169,6 +174,8 @@ ...@@ -169,6 +174,8 @@
}, },
mounted() { mounted() {
this.getProjects() this.getProjects()
this.getActivity()
this.getTeams()
this.initRadar() this.initRadar()
}, },
methods: { methods: {
...@@ -180,6 +187,18 @@ ...@@ -180,6 +187,18 @@
this.loading = false this.loading = false
}) })
}, },
getActivity() {
this.$http.get('/workplace/activity')
.then(res => {
this.activities = res.result
})
},
getTeams() {
this.$http.get('/workplace/teams')
.then(res => {
this.teams = res.result
})
},
initRadar() { initRadar() {
const dv = new DataSet.View().source(this.axisData) const dv = new DataSet.View().source(this.axisData)
...@@ -190,8 +209,6 @@ ...@@ -190,8 +209,6 @@
value: 'score' value: 'score'
}) })
console.log('dv.rows', dv.rows)
this.radarData = dv.rows this.radarData = dv.rows
} }
} }
......
<template>
<div class="card-list" ref="content">
<a-list
:grid="{gutter: 24, lg: 3, md: 2, sm: 1, xs: 1}"
:dataSource="dataSource"
>
<a-list-item slot="renderItem" slot-scope="item, index">
<template v-if="item === null">
<a-button class="new-btn" type="dashed">
<a-icon type="plus"/>
新增产品
</a-button>
</template>
<template v-else>
<a-card :hoverable="true">
<a-card-meta>
<div style="margin-bottom: 3px" slot="title">{{item.title}}</div>
<a-avatar class="card-avatar" slot="avatar" :src="item.avatar" size="large"/>
<div class="meta-content" slot="description">{{item.content}}</div>
</a-card-meta>
<ul class="ant-card-actions" slot="actions">
<li><a>操作一</a></li>
<li><a>操作二</a></li>
</ul>
</a-card>
</template>
</a-list-item>
</a-list>
</div>
</template>
<script>
const dataSource = []
dataSource.push(null)
for (let i = 0; i < 11; i++) {
dataSource.push({
title: 'Alipay',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png',
content: '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。'
})
}
export default {
name: "CardList",
data () {
return {
description: '段落示意:蚂蚁金服务设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态, 提供跨越设计与开发的体验解决方案。',
linkList: [
{ icon: 'rocket', href: '#', title: '快速开始' },
{ icon: 'info-circle-o', href: '#', title: '产品简介' },
{ icon: 'file-text', href: '#', title: '产品文档' }
],
extraImage: 'https://gw.alipayobjects.com/zos/rmsportal/RzwpdLnhmvDJToTdfDPe.png',
dataSource
}
}
}
</script>
<style lang="scss" scoped>
.card-avatar {
width: 48px;
height: 48px;
border-radius: 48px;
}
.ant-card-actions {
background: #f7f9fa;
li {
float: left;
text-align: center;
margin: 12px 0;
color: rgba(0, 0, 0, 0.45);
width: 50%;
&:not(:last-child) {
border-right: 1px solid #e8e8e8;
}
a {
color: rgba(0, 0, 0, .45);
line-height: 22px;
display: inline-block;
width: 100%;
&:hover {
color: #1890ff;
}
}
}
}
.new-btn {
background-color: #fff;
border-radius: 2px;
width: 100%;
height: 188px;
}
.meta-content {
position: relative;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
height: 64px;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment