'admin-21.02.27:新增用户管理、表格适配、移动端滚动条优化等'

This commit is contained in:
lyt-Top 2021-02-27 12:49:48 +08:00
parent 1cc3490440
commit 956aed0c2b
8 changed files with 192 additions and 28 deletions

View File

@ -24,26 +24,6 @@ body,
overflow: hidden;
}
::-webkit-scrollbar-track-piece {
background-color: #f8f8f8;
}
// 滚动条的宽度
::-webkit-scrollbar {
width: 7px;
height: 7px;
}
// 滚动条的设置
::-webkit-scrollbar-thumb {
background-color: rgba(144, 147, 153, 0.3);
background-clip: padding-box;
min-height: 28px;
border-radius: 5px;
transition: 0.3s background-color;
}
::-webkit-scrollbar-thumb:hover {
background-color: rgba(144, 147, 153, 0.5);
}
/* 主布局样式
------------------------------- */
.layout-container {

View File

@ -6,3 +6,5 @@
@import './home.scss';
@import './chart.scss';
@import './form.scss';
@import './scrollbar.scss';
@import './pagination.scss';

View File

@ -0,0 +1,15 @@
@import './index.scss';
/* 页面宽度小于576px
------------------------------- */
@media screen and (max-width: $xs) {
.el-pager,
.el-pagination__jump {
display: none !important;
}
}
// 默认居中对齐
.el-pagination {
text-align: center !important;
}

View File

@ -0,0 +1,56 @@
@import './index.scss';
/* 页面宽度小于768px
------------------------------- */
@media screen and (max-width: $sm) {
// 滚动条的宽度
::-webkit-scrollbar {
width: 3px !important;
height: 3px !important;
}
::-webkit-scrollbar-track-piece {
background-color: #f8f8f8;
}
// 滚动条的设置
::-webkit-scrollbar-thumb {
background-color: rgba(144, 147, 153, 0.3);
background-clip: padding-box;
min-height: 28px;
border-radius: 5px;
transition: 0.3s background-color;
}
::-webkit-scrollbar-thumb:hover {
background-color: rgba(144, 147, 153, 0.5);
}
// element plus scrollbar
.el-scrollbar__bar.is-vertical {
width: 2px !important;
}
.el-scrollbar__bar.is-horizontal {
height: 2px !important;
}
}
/* 页面宽度大于768px
------------------------------- */
@media screen and (min-width: 769px) {
// 滚动条的宽度
::-webkit-scrollbar {
width: 7px;
height: 7px;
}
::-webkit-scrollbar-track-piece {
background-color: #f8f8f8;
}
// 滚动条的设置
::-webkit-scrollbar-thumb {
background-color: rgba(144, 147, 153, 0.3);
background-clip: padding-box;
min-height: 28px;
border-radius: 5px;
transition: 0.3s background-color;
}
::-webkit-scrollbar-thumb:hover {
background-color: rgba(144, 147, 153, 0.5);
}
}

View File

@ -0,0 +1,16 @@
<template>
<div class="system-menu-add-container"></div>
</template>
<script lang="ts">
import { reactive, toRefs } from "vue";
export default {
name: "systemAddMenu",
setup() {
const state = reactive({});
return {
...toRefs(state),
};
},
};
</script>

View File

@ -0,0 +1,16 @@
<template>
<div class="system-menu-edit-container"></div>
</template>
<script lang="ts">
import { reactive, toRefs } from "vue";
export default {
name: "systemEditMenu",
setup() {
const state = reactive({});
return {
...toRefs(state),
};
},
};
</script>

View File

@ -3,7 +3,7 @@
<el-card shadow="hover">
<el-table :data="menuTableData" stripe style="width: 100%" row-key="path"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
<el-table-column label="菜单" show-overflow-tooltip>
<el-table-column label="菜单名称" show-overflow-tooltip>
<template #default="scope">
<i :class="scope.row.meta.icon"></i>
<span class="ml10">{{ scope.row.meta.title }}</span>
@ -41,7 +41,7 @@
<span v-else class="color-info"></span>
</template>
</el-table-column>
<el-table-column label="权限" show-overflow-tooltip>
<el-table-column label="权限标识" show-overflow-tooltip>
<template #default="scope">
<span>{{ scope.row.meta.auth }}</span>
</template>

View File

@ -1,21 +1,100 @@
<template>
<div>
systemUser
<el-input v-model="val"></el-input>
<div class="system-user-container">
<el-card shadow="hover">
<div class="system-user-search mb15">
<el-input size="small" placeholder="请输入用户名" prefix-icon="el-icon-search" style="max-width:180px;"></el-input>
<el-button size="small" type="primary" class="ml10">查询</el-button>
</div>
<el-table :data="tableData.data" stripe style="width: 100%">
<el-table-column prop="num" label="ID" show-overflow-tooltip></el-table-column>
<el-table-column prop="name" label="用户名" show-overflow-tooltip></el-table-column>
<el-table-column label="头像" show-overflow-tooltip>
<template #default="scope">
<el-image class="system-user-photo" :src="scope.row.photo" :preview-src-list="[scope.row.photo]">
</el-image>
</template>
</el-table-column>
<el-table-column prop="phone" label="手机" show-overflow-tooltip></el-table-column>
<el-table-column prop="email" label="邮箱" show-overflow-tooltip></el-table-column>
<el-table-column prop="sex" label="性别" show-overflow-tooltip></el-table-column>
<el-table-column prop="time" label="加入时间" show-overflow-tooltip></el-table-column>
<el-table-column prop="path" label="操作" width="90">
<template #default="scope">
<el-button size="mini" type="text">修改</el-button>
<el-button size="mini" type="text">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
:pager-count="5" :page-sizes="[10, 20, 30]" :current-page="tableData.param.pageNum" background
:page-size="tableData.param.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="tableData.total">
</el-pagination>
</el-card>
</div>
</template>
<script lang="ts">
import { toRefs, reactive } from "vue";
import { toRefs, reactive, onMounted } from "vue";
export default {
name: "systemUser",
setup() {
const state = reactive({
val: "",
tableData: {
data: [],
total: 0,
loading: false,
param: {
pageNum: 1,
pageSize: 10,
},
},
});
//
const initTableData = () => {
for (let i = 0; i < 20; i++) {
state.tableData.data.push({
num: `00${i + 1}`,
name: (Math.round(Math.random() * 20901) + 19968).toString(16),
photo:
"https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3142181265,1044547961&fm=11&gp=0.jpg",
phone: Math.floor(Math.random() * 10000000000),
email: `${Math.floor(Math.random() * 1000)}@qq.com`,
sex: i % 2 === 0 ? "男" : "女",
time: new Date().toLocaleDateString(),
});
}
state.tableData.total = state.tableData.data.length;
};
//
const onHandleSizeChange = (val) => {
state.tableData.param.pageSize = val;
};
//
const onHandleCurrentChange = (val) => {
state.tableData.param.pageSize = val;
};
//
onMounted(() => {
initTableData();
});
return {
onHandleSizeChange,
onHandleCurrentChange,
...toRefs(state),
};
},
};
</script>
</script>
<style scoped lang="scss">
.system-user-container {
.system-user-search {
text-align: right;
}
.system-user-photo {
width: 40px;
height: 40px;
border-radius: 100%;
}
}
</style>