ADD file via upload

master
pqu3f57g4 2 years ago
parent 42f2947914
commit 079e3bda06

@ -0,0 +1,478 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v-on="http://www.w3.org/1999/xhtml"
xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="content-type" content="no-cache, must-revalidate" />
<meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT"/>
<title>管理员信息</title>
<link href="../css/bootstrap.min.css" rel="stylesheet"/>
<link href="../css/font-awesome.css" rel="stylesheet"/>
<link href="../css/basic.css" rel="stylesheet"/>
<link href="../css/custom.css" rel="stylesheet"/>
<link href="../css/element/index.css" rel="stylesheet"/>
<style>
[v-cloak] {
display: none;
}
</style>
</head>
<body>
<div id="wrapper" v-cloak>
<nav class="navbar navbar-default navbar-cls-top " role="navigation" style="margin-bottom: 0">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">后端管理系统</a>
</div>
<div class="header-right">
<a href="javascript:void(0)" class="btn btn-info" @click="logout" title="退出登录">
<i class="fa fa-sign-out fa-2x"></i>
</a>
</div>
<div class="header-right">
<a href="javascript:void(0)" class="btn btn-info" title="跳转到个人信息" @click="personalPage">
<i class="fa fa-user fa-2x"></i>
</a>
</div>
<div class="header-right" style="padding-top: 25px">欢迎你,{{ user.name }}</div>
<div class="header-left">
<a href="/front/index.html" class="btn btn-info" title="跳转到首页">
<i class="fa fa-dot-circle-o fa-2x"></i>
</a>
</div>
</nav>
<nav class="navbar-default navbar-side" role="navigation">
<div class="sidebar-collapse">
<ul class="nav" id="main-menu">
<li>
<a href="index.html"><i class="fa fa-dashboard"></i>系统首页</a>
</li>
<li>
<a href="#"><i class="fa fa-yelp "></i>信息展示 <span class="fa arrow"></span></a>
<ul class="nav nav-second-level collapse in">
<li v-if="authority.indexOf(1) != -1">
<a href="adminInfo.html" class="active-menu"><i class="fa fa-table"></i>管理员信息</a>
</li>
<li v-if="authority.indexOf(2) != -1">
<a href="userInfo.html"><i class="fa fa-table"></i>用户信息</a>
</li>
<li v-if="authority.indexOf(3) != -1">
<a href="classifyInfo.html"><i class="fa fa-table"></i>菜谱大类信息</a>
</li>
<li v-if="authority.indexOf(4) != -1">
<a href="subClassifyInfo.html"><i class="fa fa-table"></i>菜谱小类信息</a>
</li>
<li v-if="authority.indexOf(5) != -1">
<a href="foodsMenuInfo.html"><i class="fa fa-table"></i>菜谱信息</a>
</li>
<li v-if="authority.indexOf(6) != -1">
<a href="foodsMaterialInfo.html"><i class="fa fa-table"></i>食材信息</a>
</li>
<li v-if="authority.indexOf(7) != -1">
<a href="collectInfo.html"><i class="fa fa-table"></i>收藏信息</a>
</li>
<li v-if="authority.indexOf(8) != -1">
<a href="praiseInfo.html"><i class="fa fa-table"></i>笔记点赞信息</a>
</li>
<li v-if="authority.indexOf(9) != -1">
<a href="notesInfo.html"><i class="fa fa-table"></i>笔记信息</a>
</li>
<li v-if="authority.indexOf(10) != -1">
<a href="newsInfo.html"><i class="fa fa-table"></i>饮食资讯信息</a>
</li>
<li v-if="authority.indexOf(1000001) != -1">
<a href="advertiserInfo.html"><i class="fa fa-table"></i>公告信息</a>
</li>
<li v-if="authority.indexOf(1000002) != -1">
<a href="messageInfo.html"><i class="fa fa-table"></i>趣味答题信息</a>
</li>
<li>
<a href="javascript:void(0)" @click="personalPage"><i class="fa fa-user"></i>个人信息</a>
</li>
</ul>
</li>
<li>
<a href="notesInfoComment.html"><i class="fa fa-file"></i>笔记信息评论</a>
</li>
<li>
<a href="updatePassword.html"><i class="fa fa-unlock-alt"></i>修改密码</a>
</li>
<li>
<a href="javascript:void(0)" @click="logout"><i class="fa fa-power-off"></i>退出登录</a>
</li>
</ul>
</div>
</nav>
<div id="page-wrapper">
<div id="page-inner">
<div class="row">
<div class="col-md-12">
<h1 class="page-subhead-line">这是管理员信息页,管理员可以对管理员信息进行操作。 </h1>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
管理员信息表
</div>
<div class="panel-body">
<div class="table-responsive">
<div class="nx-table-header">
<button class="btn btn-sm btn-primary" v-on:click="add()">新增</button>
<button class="btn btn-sm btn-primary">批量导入</button>
<input @click="clickUpload" @change="upload" type="file" multiple ref="file"
style="position:absolute;top:0;left:50px;opacity:0;width:70px;height:30px;">
<button class="btn btn-sm btn-primary" v-on:click="downModel">下载模板</button>
<input type="text" placeholder="请输入搜索内容" v-model="name" @keyup.enter="loadTable(1)">
<i class="glyphicon glyphicon-search"></i>
</div>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>ID</th>
<th>姓名</th>
<th>昵称</th>
<th>性别</th>
<th>年龄</th>
<th>生日</th>
<th>手机号</th>
<th>地址</th>
<th>编号</th>
<th>邮箱</th>
<th>身份证</th>
<th>操作</th>
</tr>
</thead>
<tbody v-for="obj in objs">
<tr>
<td>{{obj.id}}</td>
<td>{{obj.name}}</td>
<td>{{obj.nickName}}</td>
<td>{{obj.sex}}</td>
<td>{{obj.age}}</td>
<td>{{obj.birthday}}</td>
<td>{{obj.phone}}</td>
<td>{{obj.address}}</td>
<td>{{obj.code}}</td>
<td>{{obj.email}}</td>
<td>{{obj.cardId}}</td>
<td>
<button class="btn btn-primary btn-xs" v-on:click="init(obj)">编辑</button>
<button class="btn btn-danger btn-xs" v-on:click="del(obj.id)">删除</button>
</td>
</tr>
</tbody>
</table>
<nav aria-label="Page navigation example">
<ul class="pagination">
<li class="page-item" v-bind:class="{ disabled: preActive }">
<a class="page-link" href="javascript:void(0)"
v-on:click="loadTable(pageInfo.pageNum - 1)">上一页</a>
</li>
<li class="page-item">
<a class="page-link" href="javascript:void(0)" v-if="pageInfo.pageNum > 1" v-on:click="loadTable(pageInfo.pageNum - 1)">{{pageInfo.pageNum - 1}}</a>
</li>
<li class="page-item disabled">
<a class="page-link" aria-disabled="true" href="javascript:void(0)">{{pageInfo.pageNum}}</a>
</li>
<li class="page-item">
<a class="page-link" href="javascript:void(0)" v-if="pageInfo.hasNextPage" v-on:click="loadTable(pageInfo.pageNum + 1)">{{pageInfo.pageNum + 1}}</a>
</li>
<li class="page-item" v-bind:class="{ disabled: nextActive }">
<a class="page-link" href="javascript:void(0)" v-on:click="loadTable(pageInfo.hasNextPage? (pageInfo.pageNum + 1) : pageInfo.pageNum)">下一页</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 模态框Modal -->
<div class="modal" tabindex="-1" role="dialog" id="mod">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<span class="modal-title">请填写信息</span>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" @click="entity={sex:'男'}">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form class="form-horizontal">
<input type="hidden" id="id" name="id" v-model="entity.id">
<div class="form-group">
<label class="col-sm-3 control-label">姓名</label>
<div class="col-sm-7">
<input type="text" class="form-control" v-model="entity.name" placeholder="请输入姓名" id="name">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">昵称</label>
<div class="col-sm-7">
<input type="text" class="form-control" v-model="entity.nickName" placeholder="请输入昵称" id="nickName">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">性别</label>
<div class="col-sm-7">
<label class="radio-inline">
<input type="radio" value="男" v-model="entity.sex" id="sex">
</label>
<label class="radio-inline">
<input type="radio" value="女" v-model="entity.sex" id="sex">
</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">年龄</label>
<div class="col-sm-7">
<input type="text" class="form-control" v-model="entity.age" placeholder="请输入年龄" id="age">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">生日</label>
<div class="col-sm-7">
<div class="block">
<el-date-picker v-model="entity.birthday" id="birthday" type="datetime" clearable value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期时间"></el-date-picker>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">手机号</label>
<div class="col-sm-7">
<input type="text" class="form-control" v-model="entity.phone" placeholder="请输入手机号" id="phone">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">地址</label>
<div class="col-sm-7">
<input type="text" class="form-control" v-model="entity.address" placeholder="请输入地址" id="address">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">编号</label>
<div class="col-sm-7">
<input type="text" class="form-control" v-model="entity.code" placeholder="请输入编号" id="code">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">邮箱</label>
<div class="col-sm-7">
<input type="text" class="form-control" v-model="entity.email" placeholder="请输入邮箱" id="email">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">身份证</label>
<div class="col-sm-7">
<input type="text" class="form-control" v-model="entity.cardId" placeholder="请输入身份证" id="cardId">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" @click="entity={sex:'男'}">关闭</button>
<button type="button" class="btn btn-primary" v-on:click="update()">保存</button>
</div>
</div>
</div>
</div>
</div>
<script src="../js/jquery-1.10.2.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/jquery.metisMenu.js"></script>
<script src="../js/custom.js"></script>
<script src="../js/my.js"></script>
<script src="../js/vue2.6.11/vue.min.js"></script>
<script src="../js/vue2.6.11/axios.js"></script>
<script src="../js/element/index.js"></script>
<script>
function msg(type, msg) {
Vue.prototype.$message({
type: type, // success成功、warning警告, error(错误)
message: msg,
duration: 2000,
offset: 100,
center: true
})
}
new Vue({
el: '#wrapper',
data: {
authority: [],
permission: [],
storeUser: JSON.parse(localStorage.getItem("user")),
name: '',
user: {},
objs: [],
pageInfo: {},
preActive: true,
nextActive: true,
entity: {
sex: '男'
}
},
created: function () {
this.loadTable(1);
this.user = JSON.parse(localStorage.getItem('user'));
axios.get("/permission/1").then(res => {
if (res.data.code === '0') {
this.permission = res.data.data;
} else {
msg('error', res.data.msg);
}
});
axios.get("/authority").then(res => {
if (res.data.code === '0') {
this.authority = res.data.data;
} else {
msg('error', res.data.msg);
}
});
},
methods: {
loadTable(pageNum) {
let name = this.name === '' ? "all" : this.name;
axios.get("/adminInfo/page/" + name + "?pageNum=" + pageNum).then(res => {
if (res.data.code === '0') {
this.objs = res.data.data.list;
this.pageInfo = res.data.data;
this.preActive = !(this.pageInfo.hasPreviousPage);
this.nextActive = !(this.pageInfo.hasNextPage);
} else {
msg('error', res.data.msg);
}
});
},
init(o) {
if (this.permission.indexOf(3) === -1) {
msg('warning', '你没有权限操作');
return;
}
this.entity = JSON.parse(JSON.stringify(o));
$('#mod').modal('show');
},
add() {
if (this.permission.indexOf(1) === -1) {
msg('warning', '你没有权限操作');
return;
}
this.entity = {sex:'男'};
$('#mod').modal('show');
},
update() {
if (checkValid(this.entity)) {
if (!this.entity.id) {
axios.post(
"/adminInfo", this.entity
).then(res => {
if (res.data.code === '0') {
msg('success', '添加成功');
$('#mod').modal('hide');
this.loadTable(1);
} else {
msg('error', res.data.msg);
}
})
} else {
axios.put(
"/adminInfo", this.entity
).then(res => {
if (res.data.code === '0') {
msg('success', '更新成功');
$('#mod').modal('hide');
this.loadTable(1);
} else {
msg('error', res.data.msg);
}
})
}
}
},
del(id) {
if (this.permission.indexOf(2) === -1) {
msg('warning', '你没有权限操作');
return;
}
let _this = this;
this.$confirm('确认删除?', '系统提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
cancelButtonClass: 'btn-custom-cancel',
type: 'warning'
}).then(function(){
axios.delete("/adminInfo/" + id).then(res => {
if (res.data.code === '0') {
msg('success', '删除成功');
_this.loadTable(1);
} else {
msg('error', res.data.msg);
}
});
}).catch(function() {
console.log("取消成功!");
});
},
downModel() {
location.href = '/adminInfo/getExcelModel';
},
clickUpload: function (e) {
if (this.permission.indexOf(1) === -1) {
msg('warning', '你没有权限操作');
e.preventDefault();
}
},
upload: function () {
let files = this.$refs.file.files;
for (let i = 0; i < files.length; i++) {
let formData = new FormData();
formData.append('file', files[i]);
axios.post('/adminInfo/upload', formData, {
'Content-Type': 'multipart/form-data'
}).then(res => {
if (res.data.code === '0') {
msg('success', '批量导入成功');
this.loadTable(1);
} else {
msg('error', res.data.msg);
}
})
}
},
logout() {
logout();
}
}
})
</script>
</body>
</html>
Loading…
Cancel
Save