init : 初始化仓库
This commit is contained in:
371
src/views/home/index.vue
Normal file
371
src/views/home/index.vue
Normal file
@@ -0,0 +1,371 @@
|
||||
<template>
|
||||
<el-row :gutter="20" class="home-container">
|
||||
<el-col :span="18">
|
||||
<div class="home-top">
|
||||
<el-image :src="homeImage" style="width: 380px"/>
|
||||
<div class="top-right">
|
||||
<div>{{ authStore.userinfo.userName }},欢迎回来!</div>
|
||||
<div>
|
||||
开源等于互助,开源需要大家一起来支持!欢迎加入我们!缘境后台管理系统是一套基于角色的权限管理系统, 方便用户更好的管理各项数据; 对于开发者而言, 它是一套快速开发框架。
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<div class="home-top-right">
|
||||
<el-image :src="coffee" style="height: 100px"/>
|
||||
<span>SmartOpsWeb </span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20" class="statistics">
|
||||
<el-col :span="6" v-for="(item,index) in list" :key="index">
|
||||
<div class="block">
|
||||
<div>{{ item.title }}</div>
|
||||
<div>
|
||||
<el-icon>
|
||||
<User/>
|
||||
</el-icon>
|
||||
<span>{{ item.num }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20" style="margin-top: 50px">
|
||||
<el-col :span="8">
|
||||
<div class="container">
|
||||
<div id="line" ref="line"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="container">
|
||||
<div id="rose" ref="rose"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="container">
|
||||
<div id="radar" ref="radar"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import * as echarts from 'echarts'
|
||||
import homeImage from "@/assets/home/home.png"
|
||||
import coffee from "@/assets/home/coffee.png"
|
||||
import {useAuthStore} from '@/stores/userstore.js'
|
||||
|
||||
const authStore = useAuthStore()
|
||||
const list = ref([
|
||||
{
|
||||
title: '在线用户量',
|
||||
num: 21
|
||||
},
|
||||
{
|
||||
title: '用户总数',
|
||||
num: 242
|
||||
},
|
||||
{
|
||||
title: '角色总数',
|
||||
num: 42
|
||||
},
|
||||
{
|
||||
title: '部门总数',
|
||||
num: 14
|
||||
}
|
||||
])
|
||||
const barOption = {
|
||||
color: ['#80FFA5', '#00DDFF', '#37A2FF', '#FF0087', '#FFBF00'],
|
||||
title: {
|
||||
text: '用户增长情况'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'cross',
|
||||
label: {
|
||||
backgroundColor: '#6a7985'
|
||||
}
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
// data: ['Line 1', 'Line 2', 'Line 3', 'Line 4', 'Line 5']
|
||||
},
|
||||
toolbox: {},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value'
|
||||
}
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: '访问量',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
smooth: true,
|
||||
lineStyle: {
|
||||
width: 0
|
||||
},
|
||||
showSymbol: false,
|
||||
areaStyle: {
|
||||
opacity: 0.8,
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{
|
||||
offset: 0,
|
||||
color: 'rgb(128, 255, 165)'
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: 'rgb(1, 191, 236)'
|
||||
}
|
||||
])
|
||||
},
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
},
|
||||
data: [140, 232, 101, 264, 90, 340, 250]
|
||||
},
|
||||
{
|
||||
name: '在线量',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
smooth: true,
|
||||
lineStyle: {
|
||||
width: 0
|
||||
},
|
||||
showSymbol: false,
|
||||
areaStyle: {
|
||||
opacity: 0.8,
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{
|
||||
offset: 0,
|
||||
color: 'rgb(0, 221, 255)'
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: 'rgb(77, 119, 255)'
|
||||
}
|
||||
])
|
||||
},
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
},
|
||||
data: [120, 282, 111, 234, 220, 340, 310]
|
||||
},
|
||||
]
|
||||
};
|
||||
|
||||
const roseOption = {
|
||||
tooltip: {
|
||||
trigger: 'item'
|
||||
},
|
||||
title: {
|
||||
text: '系统管理',
|
||||
},
|
||||
legend: {
|
||||
top: 'bottom',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
type: 'pie',
|
||||
radius: [50, 150],
|
||||
center: ['50%', '50%'],
|
||||
roseType: 'area',
|
||||
itemStyle: {
|
||||
borderRadius: 8
|
||||
},
|
||||
data: [
|
||||
{value: 40, name: '用户总数'},
|
||||
{value: 38, name: '角色总数'},
|
||||
{value: 32, name: '部门总数'},
|
||||
{value: 30, name: '岗位总数'},
|
||||
{value: 28, name: '字典总数'},
|
||||
{value: 26, name: '公告总数'},
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
const radarOption = {
|
||||
tooltip: {
|
||||
trigger: 'item'
|
||||
},
|
||||
title: {
|
||||
text: '浏览器比例', subtext: 'Fake Data',
|
||||
},
|
||||
legend: {
|
||||
type: 'scroll',
|
||||
bottom: 10,
|
||||
data: (function () {
|
||||
const list = [];
|
||||
for (let i = 1; i <= 28; i++) {
|
||||
list.push(i + 2000 + '');
|
||||
}
|
||||
return list;
|
||||
})()
|
||||
},
|
||||
visualMap: {
|
||||
top: 'middle',
|
||||
right: 10,
|
||||
color: ['red', 'yellow'],
|
||||
calculable: true
|
||||
},
|
||||
radar: {
|
||||
indicator: [
|
||||
{ text: 'IE8-', max: 400 },
|
||||
{ text: 'IE9+', max: 400 },
|
||||
{ text: 'Safari', max: 400 },
|
||||
{ text: 'Firefox', max: 400 },
|
||||
{ text: 'Chrome', max: 400 }
|
||||
]
|
||||
},
|
||||
series: (function () {
|
||||
const series = [];
|
||||
for (let i = 1; i <= 28; i++) {
|
||||
series.push({
|
||||
type: 'radar',
|
||||
symbol: 'none',
|
||||
lineStyle: {
|
||||
width: 1
|
||||
},
|
||||
emphasis: {
|
||||
areaStyle: {
|
||||
color: 'rgba(0,250,0,0.3)'
|
||||
}
|
||||
},
|
||||
data: [
|
||||
{
|
||||
value: [
|
||||
(40 - i) * 10,
|
||||
(38 - i) * 4 + 60,
|
||||
i * 5 + 10,
|
||||
i * 9,
|
||||
(i * i) / 2
|
||||
],
|
||||
name: i + 2000 + ''
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
return series;
|
||||
})()
|
||||
};
|
||||
|
||||
const data = reactive({
|
||||
barCharts: null,
|
||||
pieCharts: null,
|
||||
radarCharts: null,
|
||||
line: null,
|
||||
rose: null,
|
||||
radar: null,
|
||||
})
|
||||
|
||||
const init = () => {
|
||||
data.barCharts = echarts.init(document.getElementById('line')).setOption(barOption)
|
||||
data.pieCharts = echarts.init(document.getElementById('rose')).setOption(roseOption)
|
||||
data.radarCharts = echarts.init(document.getElementById('radar')).setOption(radarOption)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
init()
|
||||
})
|
||||
|
||||
window.addEventListener('resize', () => {
|
||||
data.line = null
|
||||
data.rose = null
|
||||
data.barCharts = null
|
||||
data.pieCharts = null
|
||||
init()
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.home-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.home-top {
|
||||
//width: 1000px;
|
||||
height: 150px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px;
|
||||
margin-top: 10px;
|
||||
background-color: #e1eaf9;
|
||||
|
||||
.top-right {
|
||||
font-size: 16px;
|
||||
margin-left: 10px;
|
||||
letter-spacing: 1.5px;
|
||||
|
||||
> div:first-child {
|
||||
color: #557ad2;
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.home-top-right {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
.statistics {
|
||||
//display: flex;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
|
||||
.block {
|
||||
background-color: #e9edf2;
|
||||
border-radius: 4px;
|
||||
padding: 25px;
|
||||
|
||||
> div:first-child {
|
||||
color: #92969a;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
> div:last-child {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
color: #2c3f5d;
|
||||
font-size: 28px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.container {
|
||||
height: calc((100vh / 2) - 150px);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
|
||||
> div {
|
||||
height: 400px;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user