Commit 36b3f2de by Sendya

update: layout style

support mobile style
parent e24bff54
<template> <template>
<div class="rank"> <div class="rank">
<h4 class="title">{{ title }}</h4> <h4 class="title">{{ title }}</h4>
<ul class="list"> <ul class="list">
<li :key="index" v-for="(item, index) in list"> <li :key="index" v-for="(item, index) in list">
<span :class="index < 3 ? 'active' : null">{{ index + 1 }}</span> <span :class="index < 3 ? 'active' : null">{{ index + 1 }}</span>
<span >{{ item.name }}</span> <span>{{ item.name }}</span>
<span >{{ item.total }}</span> <span>{{ item.total }}</span>
</li> </li>
</ul> </ul>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: "RankList", name: "RankList",
// ['title', 'list'] // ['title', 'list']
props: { props: {
title: { title: {
type: String, type: String,
default: '' default: ''
}, },
list: { list: {
type: Array, type: Array,
default: null default: null
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.rank { .rank {
padding: 0 32px 32px 72px; padding: 0 32px 32px 72px;
.list { .list {
margin: 25px 0 0; margin: 25px 0 0;
padding: 0; padding: 0;
list-style: none; list-style: none;
li { li {
margin-top: 16px; margin-top: 16px;
span { span {
color: rgba(0, 0, 0, .65); color: rgba(0, 0, 0, .65);
font-size: 14px; font-size: 14px;
line-height: 22px; line-height: 22px;
&:first-child { &:first-child {
background-color: #f5f5f5; background-color: #f5f5f5;
border-radius: 20px; border-radius: 20px;
display: inline-block; display: inline-block;
font-size: 12px; font-size: 12px;
font-weight: 600; font-weight: 600;
margin-right: 24px; margin-right: 24px;
height: 20px; height: 20px;
line-height: 20px; line-height: 20px;
width: 20px; width: 20px;
text-align: center; text-align: center;
} }
&.active { &.active {
background-color: #314659; background-color: #314659;
color: #fff; color: #fff;
} }
&:last-child { &:last-child {
float: right; float: right;
} }
} }
} }
} }
} }
.mobile .rank {
padding: 0 32px 32px 32px;
}
</style> </style>
\ No newline at end of file
<template> <template>
<a-layout class="layout"> <a-layout class="layout" :class="device">
<a-drawer <a-drawer
v-if="device === 'mobile'" v-if="device === 'mobile'"
wrapClassName="drawer-sider" :wrapClassName="'drawer-sider ' + theme"
placement="left" placement="left"
@close="() => this.collapsed = false" @close="() => this.collapsed = false"
:closable="false" :closable="false"
...@@ -93,6 +93,14 @@ ...@@ -93,6 +93,14 @@
min-height: 100vh; min-height: 100vh;
overflow-x: hidden; overflow-x: hidden;
&.mobile {
.ant-table-wrapper {
.ant-table-body {
overflow-y: auto;
}
}
}
&.ant-layout-has-sider { &.ant-layout-has-sider {
flex-direction: row; flex-direction: row;
} }
...@@ -156,6 +164,22 @@ ...@@ -156,6 +164,22 @@
// drawer-sider 自定义 // drawer-sider 自定义
.ant-drawer.drawer-sider { .ant-drawer.drawer-sider {
.sider {
box-shadow: none;
}
&.dark {
.ant-drawer-content {
background-color: rgb(0, 21, 41);
}
}
&.light {
box-shadow: none;
.ant-drawer-content {
background-color: #fff;
}
}
.ant-drawer-body { .ant-drawer-body {
padding: 0 padding: 0
} }
......
<template> <template>
<div class="page-header"> <div class="page-header">
<a-breadcrumb class="breadcrumb"> <a-breadcrumb class="breadcrumb">
<a-breadcrumb-item v-for="(item, index) in breadList" :key="index"> <a-breadcrumb-item v-for="(item, index) in breadList" :key="index">
<router-link v-if="item.name != name" :to="{ path: item.path }"> <router-link v-if="item.name != name" :to="{ path: item.path }">
{{ item.meta.title }} {{ item.meta.title }}
</router-link> </router-link>
<span v-else>{{ item.meta.title }}</span> <span v-else>{{ item.meta.title }}</span>
</a-breadcrumb-item> </a-breadcrumb-item>
</a-breadcrumb> </a-breadcrumb>
<div class="detail"> <div class="detail">
<div class="main" v-if="!$route.meta.hiddenPageHeader"> <div class="main" v-if="!$route.meta.hiddenPageHeader">
<div class="row"> <div class="row">
<img v-if="logo" :src="logo" class="logo"/> <img v-if="logo" :src="logo" class="logo"/>
<h1 v-if="title" class="title">{{ title }}</h1> <h1 v-if="title" class="title">{{ title }}</h1>
<div class="action"> <div class="action">
<slot name="action"></slot> <slot name="action"></slot>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div v-if="avatar" class="avatar"> <div v-if="avatar" class="avatar">
<a-avatar :src="avatar"/> <a-avatar :src="avatar"/>
</div> </div>
<div v-if="this.$slots.content" class="content"> <div v-if="this.$slots.content" class="content">
<slot name="content"></slot> <slot name="content"></slot>
</div> </div>
<div v-if="this.$slots.extra" class="extra"> <div v-if="this.$slots.extra" class="extra">
<slot name="extra"></slot> <slot name="extra"></slot>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import Breadcrumb from '@/components/tools/Breadcrumb' import Breadcrumb from '@/components/tools/Breadcrumb'
export default { export default {
name: "PageHeader", name: "PageHeader",
components: { components: {
"s-breadcrumb": Breadcrumb "s-breadcrumb": Breadcrumb
}, },
props: { props: {
title: { title: {
type: String, type: String,
default: '', default: '',
required: false required: false
}, },
breadcrumb: { breadcrumb: {
type: Array, type: Array,
default: null, default: null,
required: false required: false
}, },
logo: { logo: {
type: String, type: String,
default: '', default: '',
required: false required: false
}, },
avatar: { avatar: {
type: String, type: String,
default: '', default: '',
required: false required: false
} }
}, },
data() { data() {
return { return {
name: '', name: '',
breadList: [], breadList: [],
} }
}, },
created() { created() {
this.getBreadcrumb() this.getBreadcrumb()
}, },
methods: { methods: {
getBreadcrumb() { getBreadcrumb() {
this.breadList = [] this.breadList = []
this.breadList.push({name: 'index', path: '/dashboard/', meta: {title: '首页'}}) this.breadList.push({name: 'index', path: '/dashboard/', meta: {title: '首页'}})
this.name = this.$route.name this.name = this.$route.name
this.$route.matched.forEach((item) => { this.$route.matched.forEach((item) => {
// item.meta.name === 'dashboard' ? item.path = '/dashboard' : this.$route.path === item.path // item.meta.name === 'dashboard' ? item.path = '/dashboard' : this.$route.path === item.path
this.breadList.push(item) this.breadList.push(item)
}) })
} }
}, },
watch: { watch: {
$route() { $route() {
this.getBreadcrumb() this.getBreadcrumb()
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.page-header { .page-header {
background: #fff; background: #fff;
padding: 16px 32px 0; padding: 16px 32px 0;
border-bottom: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8;
.breadcrumb { .breadcrumb {
margin-bottom: 16px; margin-bottom: 16px;
} }
.detail { .detail {
display: flex; display: flex;
/*margin-bottom: 16px;*/ /*margin-bottom: 16px;*/
.avatar { .avatar {
flex: 0 1 72px; flex: 0 1 72px;
margin: 0 24px 8px 0; margin: 0 24px 8px 0;
& > span { & > span {
border-radius: 72px; border-radius: 72px;
display: block; display: block;
width: 72px; width: 72px;
height: 72px; height: 72px;
} }
} }
.main { .main {
width: 100%; width: 100%;
flex: 0 1 auto; flex: 0 1 auto;
.row { .row {
display: flex; display: flex;
width: 100%; width: 100%;
.avatar { .avatar {
margin-bottom: 16px; margin-bottom: 16px;
} }
} }
.title { .title {
font-size: 20px; font-size: 20px;
font-weight: 500; font-weight: 500;
font-size: 20px; font-size: 20px;
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: 16px; margin-bottom: 16px;
flex: auto; flex: auto;
} }
.logo { .logo {
width: 28px; width: 28px;
height: 28px; height: 28px;
border-radius: 4px; border-radius: 4px;
margin-right: 16px; margin-right: 16px;
} }
.content { .content {
flex: auto; flex: auto;
color: rgba(0,0,0,.45); color: rgba(0,0,0,.45);
line-height: 22px; line-height: 22px;
} }
.extra { .extra {
flex: 0 1 auto; flex: 0 1 auto;
margin-left: 88px; margin-left: 88px;
min-width: 242px; min-width: 242px;
text-align: right; text-align: right;
} }
.action { .action {
margin-left: 56px; margin-left: 56px;
min-width: 266px; min-width: 266px;
flex: 0 1 auto; flex: 0 1 auto;
text-align: right; text-align: right;
&:empty { &:empty {
display: none; display: none;
} }
} }
} }
} }
} }
.mobile .page-header {
.main {
.row {
flex-wrap: wrap;
}
.extra {
flex: 1 1 auto;
margin-left: 0;
min-width: 0;
text-align: right;
}
}
}
</style> </style>
\ No newline at end of file
<template> <template>
<page-layout :avatar="avatar"> <page-layout :avatar="avatar">
<div slot="headerContent"> <div slot="headerContent">
<div class="title">{{ timeFix }},{{ user.name }},{{ welcome() }}</div> <div class="title">{{ timeFix }},{{ user.name }}<span class="welcome-text">,{{ welcome() }}</span></div>
<div>前端工程师 | 蚂蚁金服 - 某某某事业群 - VUE平台</div> <div>前端工程师 | 蚂蚁金服 - 某某某事业群 - VUE平台</div>
</div> </div>
<div slot="extra"> <div slot="extra">
<a-row> <a-row class="more-info">
<a-col :sm="8" :xs="24"> <a-col :span="8">
<head-info title="项目数" content="56" :bordered="true"/> <head-info title="项目数" content="56" :bordered="true"/>
</a-col> </a-col>
<a-col :sm="8" :xs="24"> <a-col :span="8">
<head-info title="团队排名" content="8/24" :bordered="true"/> <head-info title="团队排名" content="8/24" :bordered="true"/>
</a-col> </a-col>
<a-col :sm="8" :xs="24"> <a-col :span="8">
<head-info title="项目访问" content="2,223"/> <head-info title="项目访问" content="2,223"/>
</a-col> </a-col>
</a-row> </a-row>
</div> </div>
<div> <div>
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :xl="16" :lg="24" :md="24" :sm="24" :xs="24"> <a-col :xl="16" :lg="24" :md="24" :sm="24" :xs="24">
<a-card <a-card
class="project-list" class="project-list"
:loading="loading" :loading="loading"
style="margin-bottom: 24px;" style="margin-bottom: 24px;"
:bordered="false" :bordered="false"
title="进行中的项目" title="进行中的项目"
:body-style="{ padding: 0 }"> :body-style="{ padding: 0 }">
<a slot="extra">全部项目</a> <a slot="extra">全部项目</a>
<div> <div>
<a-card-grid :key="i" v-for="(item, i) in projects"> <a-card-grid :key="i" v-for="(item, i) in projects">
<a-card :bordered="false" :body-style="{ padding: 0 }"> <a-card :bordered="false" :body-style="{ padding: 0 }">
<a-card-meta> <a-card-meta>
<div slot="title" class="card-title"> <div slot="title" class="card-title">
<a-avatar size="small" :src="item.cover"/> <a-avatar size="small" :src="item.cover"/>
<a>{{ item.title }}</a> <a>{{ item.title }}</a>
</div> </div>
<div slot="description" class="card-description"> <div slot="description" class="card-description">
{{ item.description }} {{ item.description }}
</div> </div>
</a-card-meta> </a-card-meta>
<div class="project-item"> <div class="project-item">
<a href="/#/">科学搬砖组</a> <a href="/#/">科学搬砖组</a>
<span class="datetime">9小时前</span> <span class="datetime">9小时前</span>
</div> </div>
</a-card> </a-card>
</a-card-grid> </a-card-grid>
</div> </div>
</a-card> </a-card>
<a-card :loading="loading" title="动态" :bordered="false"> <a-card :loading="loading" title="动态" :bordered="false">
<a-list> <a-list>
<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"> <div slot="title">
<span>{{ item.user.nickname }}</span>&nbsp; <span>{{ item.user.nickname }}</span>&nbsp;
在&nbsp;<a href="#">{{ item.project.name }}</a>&nbsp; 在&nbsp;<a href="#">{{ item.project.name }}</a>&nbsp;
<span>{{ item.project.action }}</span>&nbsp; <span>{{ item.project.action }}</span>&nbsp;
<a href="#">{{ item.project.event }}</a> <a href="#">{{ item.project.event }}</a>
</div> </div>
<div slot="description">{{ item.time }}</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>
</a-card> </a-card>
</a-col> </a-col>
<a-col <a-col
style="padding: 0 12px" style="padding: 0 12px"
:xl="8" :xl="8"
:lg="24" :lg="24"
:md="24" :md="24"
:sm="24" :sm="24"
:xs="24"> :xs="24">
<a-card title="快速开始 / 便捷导航" style="margin-bottom: 24px" :bordered="false" :body-style="{padding: 0}"> <a-card title="快速开始 / 便捷导航" style="margin-bottom: 24px" :bordered="false" :body-style="{padding: 0}">
<div class="item-group"> <div class="item-group">
<a>操作一</a> <a>操作一</a>
<a>操作二</a> <a>操作二</a>
<a>操作三</a> <a>操作三</a>
<a>操作四</a> <a>操作四</a>
<a>操作五</a> <a>操作五</a>
<a>操作六</a> <a>操作六</a>
<a-button size="small" type="primary" ghost icon="plus">添加</a-button> <a-button size="small" type="primary" ghost icon="plus">添加</a-button>
</div> </div>
</a-card> </a-card>
<a-card title="XX 指数" style="margin-bottom: 24px" :loading="radarLoading" :bordered="false" :body-style="{ padding: 0 }"> <a-card title="XX 指数" style="margin-bottom: 24px" :loading="radarLoading" :bordered="false" :body-style="{ padding: 0 }">
<div style="min-height: 400px;"> <div style="min-height: 400px;">
<!-- :scale="scale" :axis1Opts="axis1Opts" :axis2Opts="axis2Opts" --> <!-- :scale="scale" :axis1Opts="axis1Opts" :axis2Opts="axis2Opts" -->
<radar :data="radarData" /> <radar :data="radarData" />
</div> </div>
</a-card> </a-card>
<a-card :loading="loading" title="团队" :bordered="false"> <a-card :loading="loading" title="团队" :bordered="false">
<div class="members"> <div class="members">
<a-row> <a-row>
<a-col :span="12" v-for="(item, index) in teams" :key="index"> <a-col :span="12" v-for="(item, index) in teams" :key="index">
<a> <a>
<a-avatar size="small" :src="item.avatar" /> <a-avatar size="small" :src="item.avatar" />
<span class="member">{{ item.name }}</span> <span class="member">{{ item.name }}</span>
</a> </a>
</a-col> </a-col>
</a-row> </a-row>
</div> </div>
</a-card> </a-card>
</a-col> </a-col>
</a-row> </a-row>
</div> </div>
</page-layout> </page-layout>
</template> </template>
<script> <script>
import { timeFix } from "@/utils/util" import { timeFix } from "@/utils/util"
import {mapGetters} from "vuex" import {mapGetters} from "vuex"
import PageLayout from '@/components/layout/PageLayout' import PageLayout from '@/components/layout/PageLayout'
import HeadInfo from '@/components/tools/HeadInfo' import HeadInfo from '@/components/tools/HeadInfo'
import Radar from '@/components/chart/Radar' import Radar from '@/components/chart/Radar'
const DataSet = require('@antv/data-set') const DataSet = require('@antv/data-set')
export default { export default {
name: "Workplace", name: "Workplace",
components: { components: {
PageLayout, PageLayout,
HeadInfo, HeadInfo,
Radar Radar
}, },
data() { data() {
return { return {
timeFix: timeFix(), timeFix: timeFix(),
avatar: '', avatar: '',
user: {}, user: {},
projects: [], projects: [],
loading: true, loading: true,
radarLoading: true, radarLoading: true,
activities: [], activities: [],
teams: [], teams: [],
// data // data
axis1Opts: { axis1Opts: {
dataKey: 'item', dataKey: 'item',
line: null, line: null,
tickLine: null, tickLine: null,
grid: { grid: {
lineStyle: { lineStyle: {
lineDash: null lineDash: null
}, },
hideFirstLine: false hideFirstLine: false
} }
}, },
axis2Opts: { axis2Opts: {
dataKey: 'score', dataKey: 'score',
line: null, line: null,
tickLine: null, tickLine: null,
grid: { grid: {
type: 'polygon', type: 'polygon',
lineStyle: { lineStyle: {
lineDash: null lineDash: null
} }
} }
}, },
scale: [{ scale: [{
dataKey: 'score', dataKey: 'score',
min: 0, min: 0,
max: 80 max: 80
}], }],
axisData: [ axisData: [
{ item: '引用', a: 70, b: 30, c: 40 }, { item: '引用', a: 70, b: 30, c: 40 },
{ item: '口碑', a: 60, b: 70, c: 40 }, { item: '口碑', a: 60, b: 70, c: 40 },
{ item: '产量', a: 50, b: 60, c: 40 }, { item: '产量', a: 50, b: 60, c: 40 },
{ item: '贡献', a: 40, b: 50, c: 40 }, { item: '贡献', a: 40, b: 50, c: 40 },
{ item: '热度', a: 60, b: 70, c: 40 }, { item: '热度', a: 60, b: 70, c: 40 },
{ item: '引用', a: 70, b: 50, c: 40 } { item: '引用', a: 70, b: 50, c: 40 }
], ],
radarData: [] radarData: []
} }
}, },
computed: { computed: {
userInfo() { userInfo() {
return this.$store.getters.userInfo return this.$store.getters.userInfo
} }
}, },
created() { created() {
this.user = this.userInfo this.user = this.userInfo
this.avatar = this.userInfo.avatar this.avatar = this.userInfo.avatar
}, },
mounted() { mounted() {
this.getProjects() this.getProjects()
this.getActivity() this.getActivity()
this.getTeams() this.getTeams()
this.initRadar() this.initRadar()
}, },
methods: { methods: {
...mapGetters(["nickname", "welcome"]), ...mapGetters(["nickname", "welcome"]),
getProjects() { getProjects() {
this.$http.get('/list/search/projects') this.$http.get('/list/search/projects')
.then(res => { .then(res => {
this.projects = res.result && res.result.data this.projects = res.result && res.result.data
this.loading = false this.loading = false
}) })
}, },
getActivity() { getActivity() {
this.$http.get('/workplace/activity') this.$http.get('/workplace/activity')
.then(res => { .then(res => {
this.activities = res.result this.activities = res.result
}) })
}, },
getTeams() { getTeams() {
this.$http.get('/workplace/teams') this.$http.get('/workplace/teams')
.then(res => { .then(res => {
this.teams = res.result this.teams = res.result
}) })
}, },
initRadar() { initRadar() {
this.radarLoading = true this.radarLoading = true
this.$http.get('/workplace/radar') this.$http.get('/workplace/radar')
.then(res => { .then(res => {
const dv = new DataSet.View().source(res.result) const dv = new DataSet.View().source(res.result)
dv.transform({ dv.transform({
type: 'fold', type: 'fold',
fields: ['个人', '团队', '部门'], fields: ['个人', '团队', '部门'],
key: 'user', key: 'user',
value: 'score' value: 'score'
}) })
this.radarData = dv.rows this.radarData = dv.rows
this.radarLoading = false this.radarLoading = false
}) })
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.project-list { .project-list {
.card-title { .card-title {
font-size: 0; font-size: 0;
a { a {
color: rgba(0, 0, 0, 0.85); color: rgba(0, 0, 0, 0.85);
margin-left: 12px; margin-left: 12px;
line-height: 24px; line-height: 24px;
height: 24px; height: 24px;
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
font-size: 14px; font-size: 14px;
&:hover { &:hover {
color: #1890ff; color: #1890ff;
} }
} }
} }
.card-description { .card-description {
color: rgba(0, 0, 0, 0.45); color: rgba(0, 0, 0, 0.45);
height: 44px; height: 44px;
line-height: 22px; line-height: 22px;
overflow: hidden; overflow: hidden;
} }
.project-item { .project-item {
display: flex; display: flex;
margin-top: 8px; margin-top: 8px;
overflow: hidden; overflow: hidden;
font-size: 12px; font-size: 12px;
height: 20px; height: 20px;
line-height: 20px; line-height: 20px;
a { a {
color: rgba(0, 0, 0, 0.45); color: rgba(0, 0, 0, 0.45);
display: inline-block; display: inline-block;
flex: 1 1 0; flex: 1 1 0;
&:hover { &:hover {
color: #1890ff; color: #1890ff;
} }
} }
.datetime { .datetime {
color: rgba(0, 0, 0, 0.25); color: rgba(0, 0, 0, 0.25);
flex: 0 0 auto; flex: 0 0 auto;
float: right; float: right;
} }
} }
.ant-card-meta-description { .ant-card-meta-description {
color: rgba(0, 0, 0, 0.45); color: rgba(0, 0, 0, 0.45);
height: 44px; height: 44px;
line-height: 22px; line-height: 22px;
overflow: hidden; overflow: hidden;
} }
} }
.item-group { .item-group {
padding: 20px 0 8px 24px; padding: 20px 0 8px 24px;
font-size: 0; font-size: 0;
a { a {
color: rgba(0, 0, 0, 0.65); color: rgba(0, 0, 0, 0.65);
display: inline-block; display: inline-block;
font-size: 14px; font-size: 14px;
margin-bottom: 13px; margin-bottom: 13px;
width: 25%; width: 25%;
} }
} }
.members { .members {
a { a {
display: block; display: block;
margin: 12px 0; margin: 12px 0;
line-height: 24px; line-height: 24px;
height: 24px; height: 24px;
.member { .member {
font-size: 14px; font-size: 14px;
color: rgba(0, 0, 0, .65); color: rgba(0, 0, 0, .65);
line-height: 24px; line-height: 24px;
max-width: 100px; max-width: 100px;
vertical-align: top; vertical-align: top;
margin-left: 12px; margin-left: 12px;
transition: all 0.3s; transition: all 0.3s;
display: inline-block; display: inline-block;
} }
&:hover { &:hover {
span { span {
color: #1890ff; color: #1890ff;
} }
} }
} }
} }
.mobile {
.more-info {
border-top: 1px solid #e8e8e8;
padding-top: 16px;
margin: 16px 0 16px;
}
.content .title .welcome-text {
display: none;
}
}
</style> </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