|
@@ -1,10 +1,13 @@
|
|
<template>
|
|
<template>
|
|
<el-container class="outter-container">
|
|
<el-container class="outter-container">
|
|
<el-header>
|
|
<el-header>
|
|
- <h3><img src="../../assets/logo.png" height="50"/></h3>
|
|
|
|
|
|
+ <h3>
|
|
|
|
+ <img src="../../assets/logo.png" height="50" />
|
|
|
|
+ </h3>
|
|
<div class="user-info">
|
|
<div class="user-info">
|
|
<i class="el-icon-s-custom"></i>
|
|
<i class="el-icon-s-custom"></i>
|
|
<span v-html="user.realName" style="margin-right:10px;"></span>
|
|
<span v-html="user.realName" style="margin-right:10px;"></span>
|
|
|
|
+ <a href="#" @click="changePassword()" style="margin-right:10px;">修改密码</a>
|
|
<a href="#" @click="logout()">退出</a>
|
|
<a href="#" @click="logout()">退出</a>
|
|
</div>
|
|
</div>
|
|
</el-header>
|
|
</el-header>
|
|
@@ -25,35 +28,105 @@
|
|
</el-menu>
|
|
</el-menu>
|
|
</el-aside>
|
|
</el-aside>
|
|
<el-main>
|
|
<el-main>
|
|
- <router-view/>
|
|
|
|
|
|
+ <router-view />
|
|
</el-main>
|
|
</el-main>
|
|
|
|
+ <el-dialog
|
|
|
|
+ title="修改密码"
|
|
|
|
+ :visible.sync="dialogFormVisible"
|
|
|
|
+ :modal-append-to-body="false"
|
|
|
|
+ :close-on-click-modal="false"
|
|
|
|
+ width="20%"
|
|
|
|
+ :before-close="colseChange"
|
|
|
|
+ >
|
|
|
|
+ <el-form ref="form" :model="form" :rules="ruleValidate">
|
|
|
|
+ <el-form-item label="旧密码" prop="oldPassword">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.oldPassword"
|
|
|
|
+ placeholder="请输入新密码"
|
|
|
|
+ style="width:100%"
|
|
|
|
+ show-password
|
|
|
|
+ ></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="新密码" prop="newPassword">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.newPassword"
|
|
|
|
+ placeholder="请输入新密码"
|
|
|
|
+ style="width:100%"
|
|
|
|
+ show-password
|
|
|
|
+ ></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="重复新密码" prop="newPasswordTwo">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.newPasswordTwo"
|
|
|
|
+ placeholder="请输入新密码"
|
|
|
|
+ style="width:100%"
|
|
|
|
+ show-password
|
|
|
|
+ ></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="colseChange">取 消</el-button>
|
|
|
|
+ <el-button type="primary" @click="changePw">确 定</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
</el-container>
|
|
</el-container>
|
|
</el-container>
|
|
</el-container>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
-import MenuTreeItem from "@/components/MenuTreeItem"
|
|
|
|
-import menuApi from "@/api/sys/menu"
|
|
|
|
-import userApi from "@/api/sys/user"
|
|
|
|
|
|
+import MenuTreeItem from "@/components/MenuTreeItem";
|
|
|
|
+import menuApi from "@/api/sys/menu";
|
|
|
|
+import userApi from "@/api/sys/user";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
|
|
+ let samePassword = (rule, value, callback) => {
|
|
|
|
+ var self = this;
|
|
|
|
+ var newPasswordTwo = value;
|
|
|
|
+ var newPassword = self.form.newPassword;
|
|
|
|
+ if (newPassword != newPasswordTwo) {
|
|
|
|
+ return callback(new Error("两次密码输入不相同"));
|
|
|
|
+ } else {
|
|
|
|
+ return callback();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
return {
|
|
return {
|
|
|
|
+ ruleValidate: {
|
|
|
|
+ oldPassword: [{ required: true, message: "不能为空", trigger: "blur" }],
|
|
|
|
+ newPassword: [{ required: true, message: "不能为空", trigger: "blur" }],
|
|
|
|
+ newPasswordTwo: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: "不能为空",
|
|
|
|
+ trigger: "blur"
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ validator: samePassword,
|
|
|
|
+ trigger: "blur"
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
menuList: [],
|
|
menuList: [],
|
|
loading: false,
|
|
loading: false,
|
|
collapse: false,
|
|
collapse: false,
|
|
- user: {}
|
|
|
|
|
|
+ user: {},
|
|
|
|
+ dialogFormVisible: false,
|
|
|
|
+ form: {
|
|
|
|
+ oldPassword: "",
|
|
|
|
+ newPassword: "",
|
|
|
|
+ newPasswordTwo: ""
|
|
|
|
+ }
|
|
};
|
|
};
|
|
},
|
|
},
|
|
- computed:{
|
|
|
|
|
|
+ computed: {
|
|
sidebarWidth() {
|
|
sidebarWidth() {
|
|
return !this.collapse ? "200px" : "64px";
|
|
return !this.collapse ? "200px" : "64px";
|
|
},
|
|
},
|
|
- sidbarHandlerClass(){
|
|
|
|
|
|
+ sidbarHandlerClass() {
|
|
return {
|
|
return {
|
|
- "iconfont" : true,
|
|
|
|
- "icon-icon_left_arrow" : this.collapse,
|
|
|
|
- "icon-icon_right_arrow" : !this.collapse
|
|
|
|
- }
|
|
|
|
|
|
+ iconfont: true,
|
|
|
|
+ "icon-icon_left_arrow": this.collapse,
|
|
|
|
+ "icon-icon_right_arrow": !this.collapse
|
|
|
|
+ };
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -71,32 +144,77 @@ export default {
|
|
this.$store.dispatch("user/logout").then(() => {
|
|
this.$store.dispatch("user/logout").then(() => {
|
|
this.$router.push({ path: "/login" });
|
|
this.$router.push({ path: "/login" });
|
|
});
|
|
});
|
|
|
|
+ },
|
|
|
|
+ changePassword() {
|
|
|
|
+ var self = this;
|
|
|
|
+ self.dialogFormVisible = true;
|
|
|
|
+ },
|
|
|
|
+ changePw() {
|
|
|
|
+ var self = this;
|
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ var formData = new FormData();
|
|
|
|
+ formData.append("oldPassword", self.form.oldPassword);
|
|
|
|
+ formData.append("newPassword", self.form.newPassword);
|
|
|
|
+
|
|
|
|
+ userApi.changeLoginPassword(formData).then(function(response) {
|
|
|
|
+ var jsonData = response.data;
|
|
|
|
+
|
|
|
|
+ if (jsonData.result) {
|
|
|
|
+ self.dialogFormVisible = false;
|
|
|
|
+ self.form.oldPassword = "";
|
|
|
|
+ self.form.newPassword = "";
|
|
|
|
+ self.form.newPasswordTwo = "";
|
|
|
|
+ self.$message({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "修改成功,下次登录生效!"
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ self.$message({
|
|
|
|
+ type: "warning",
|
|
|
|
+ message: jsonData.message
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ colseChange() {
|
|
|
|
+ var self = this;
|
|
|
|
+ self.form.oldPassword = "";
|
|
|
|
+ self.form.newPassword = "";
|
|
|
|
+ self.form.newPasswordTwo = "";
|
|
|
|
+ self.dialogFormVisible = false;
|
|
|
|
+ this.$refs["form"].resetFields();
|
|
}
|
|
}
|
|
},
|
|
},
|
|
components: {
|
|
components: {
|
|
- "menu-tree-item" : MenuTreeItem
|
|
|
|
|
|
+ "menu-tree-item": MenuTreeItem
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
this.loading = true;
|
|
this.loading = true;
|
|
|
|
|
|
- userApi.userInfo().then(resp=>{
|
|
|
|
- if(resp.data.result){
|
|
|
|
|
|
+ userApi.userInfo().then(resp => {
|
|
|
|
+ if (resp.data.result) {
|
|
this.user = resp.data.data;
|
|
this.user = resp.data.data;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
- menuApi.getMenuTree().then(response=>{
|
|
|
|
- console.log(response);
|
|
|
|
|
|
+ menuApi
|
|
|
|
+ .getMenuTree()
|
|
|
|
+ .then(response => {
|
|
|
|
+ console.log(response);
|
|
|
|
|
|
- var jsonData = response.data;
|
|
|
|
|
|
+ var jsonData = response.data;
|
|
|
|
|
|
- this.menuList = jsonData.data;
|
|
|
|
-
|
|
|
|
- this.loading = false;
|
|
|
|
- }).catch(exception=>{
|
|
|
|
- this.$message.error(exception + "");
|
|
|
|
- this.loading = false;
|
|
|
|
- });
|
|
|
|
|
|
+ this.menuList = jsonData.data;
|
|
|
|
+
|
|
|
|
+ this.loading = false;
|
|
|
|
+ })
|
|
|
|
+ .catch(exception => {
|
|
|
|
+ this.$message.error(exception + "");
|
|
|
|
+ this.loading = false;
|
|
|
|
+ });
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
@@ -112,7 +230,7 @@ export default {
|
|
color: #333;
|
|
color: #333;
|
|
text-align: left;
|
|
text-align: left;
|
|
height: 70px !important;
|
|
height: 70px !important;
|
|
- line-height:70px;
|
|
|
|
|
|
+ line-height: 70px;
|
|
// border-bottom: 2px solid rgb(36,61,162);
|
|
// border-bottom: 2px solid rgb(36,61,162);
|
|
border-bottom: 2px solid #64a63c;
|
|
border-bottom: 2px solid #64a63c;
|
|
}
|
|
}
|
|
@@ -131,7 +249,7 @@ export default {
|
|
|
|
|
|
.el-aside .el-menu {
|
|
.el-aside .el-menu {
|
|
flex: 1;
|
|
flex: 1;
|
|
- background-color:rgb(238, 238, 238);
|
|
|
|
|
|
+ background-color: rgb(238, 238, 238);
|
|
}
|
|
}
|
|
|
|
|
|
.el-main {
|
|
.el-main {
|
|
@@ -145,41 +263,41 @@ export default {
|
|
text-align: left;
|
|
text-align: left;
|
|
}
|
|
}
|
|
|
|
|
|
-.user-info{
|
|
|
|
|
|
+.user-info {
|
|
position: absolute;
|
|
position: absolute;
|
|
- right:20px;
|
|
|
|
- bottom:10px;
|
|
|
|
- font-size:14px;
|
|
|
|
|
|
+ right: 20px;
|
|
|
|
+ bottom: 10px;
|
|
|
|
+ font-size: 14px;
|
|
line-height: 30px;
|
|
line-height: 30px;
|
|
|
|
|
|
- a{
|
|
|
|
- color:blue;
|
|
|
|
|
|
+ a {
|
|
|
|
+ color: blue;
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
text-decoration: none;
|
|
text-decoration: none;
|
|
}
|
|
}
|
|
|
|
|
|
- a:hover{
|
|
|
|
|
|
+ a:hover {
|
|
text-decoration: underline;
|
|
text-decoration: underline;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-.sidebar{
|
|
|
|
- position:relative;
|
|
|
|
- overflow:visible !important;
|
|
|
|
|
|
+.sidebar {
|
|
|
|
+ position: relative;
|
|
|
|
+ overflow: visible !important;
|
|
}
|
|
}
|
|
|
|
|
|
-.sidebar-collpase-btn{
|
|
|
|
- position:absolute;
|
|
|
|
- width:12px;
|
|
|
|
- height:53px;
|
|
|
|
|
|
+.sidebar-collpase-btn {
|
|
|
|
+ position: absolute;
|
|
|
|
+ width: 12px;
|
|
|
|
+ height: 53px;
|
|
border-radius: 0px 10px 10px 0px;
|
|
border-radius: 0px 10px 10px 0px;
|
|
- top:200px;
|
|
|
|
- right:-12px;
|
|
|
|
- background-color:#eeeeee;
|
|
|
|
|
|
+ top: 200px;
|
|
|
|
+ right: -12px;
|
|
|
|
+ background-color: #eeeeee;
|
|
z-index: 1000;
|
|
z-index: 1000;
|
|
- padding-top:30px;
|
|
|
|
- padding-right:4px;
|
|
|
|
- color:black;
|
|
|
|
|
|
+ padding-top: 30px;
|
|
|
|
+ padding-right: 4px;
|
|
|
|
+ color: black;
|
|
font-weight: bold;
|
|
font-weight: bold;
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|