master
parent
fc0adfbcfd
commit
6faaf9d111
@ -0,0 +1,72 @@
|
|||||||
|
<template>
|
||||||
|
<el-form :model="form" ref="form" :rules="rules">
|
||||||
|
<el-form-item label="姓名" label-position="right" prop="name">
|
||||||
|
<el-input v-model.trim="form.name" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="密码" label-position="right" prop="password">
|
||||||
|
<el-input v-model.trim="form.password" type="password" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="submit">保存</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
save
|
||||||
|
} from '../../../api/system/user.js'
|
||||||
|
import {
|
||||||
|
getInfo
|
||||||
|
} from '../../../api/user.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
form: {
|
||||||
|
id: "",
|
||||||
|
name: "",
|
||||||
|
username: "",
|
||||||
|
password: ""
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
name: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入姓名',
|
||||||
|
trigger: 'blur'
|
||||||
|
}],
|
||||||
|
password: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入密码',
|
||||||
|
trigger: 'blur',
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
getInfo().then(res => {
|
||||||
|
this.form.id = res.id;
|
||||||
|
this.form.name = res.name
|
||||||
|
this.form.username = res.username
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
submit() {
|
||||||
|
let that = this;
|
||||||
|
this.$refs["form"].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
save(that.form).then(response => {
|
||||||
|
this.$Message.success('操作成功');
|
||||||
|
}).catch(error => {
|
||||||
|
//reject(error)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$Message.error('数据校验失败');
|
||||||
|
console.log('error submit!!');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
<template>
|
||||||
|
<div class="block">
|
||||||
|
<el-timeline>
|
||||||
|
<el-timeline-item v-for="(item,index) of timeline" :key="index" :timestamp="item.timestamp" placement="top">
|
||||||
|
<el-card>
|
||||||
|
<h4>{{ item.created_at }}</h4>
|
||||||
|
<p>{{ item.name }}</p>
|
||||||
|
</el-card>
|
||||||
|
</el-timeline-item>
|
||||||
|
</el-timeline>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
listlog
|
||||||
|
} from "../../../api/system/log.js";
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
timeline: [],
|
||||||
|
paginations: {
|
||||||
|
page: 1,
|
||||||
|
page_size: 15,
|
||||||
|
total: 0
|
||||||
|
},
|
||||||
|
tableHeight: 0,
|
||||||
|
//查询条件字段
|
||||||
|
searchFields: {
|
||||||
|
keyword: ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.load();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
load() {
|
||||||
|
var that = this;
|
||||||
|
listlog({
|
||||||
|
page: that.paginations.page,
|
||||||
|
...this.searchFields
|
||||||
|
}).then(response => {
|
||||||
|
var data = response.data;
|
||||||
|
this.paginations.total = response.total;
|
||||||
|
that.timeline = data;
|
||||||
|
}).catch(error => {
|
||||||
|
console.log(error)
|
||||||
|
//reject(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@ -0,0 +1,118 @@
|
|||||||
|
<template>
|
||||||
|
<el-card style="margin-bottom:20px;">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>个人信息</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="user-profile">
|
||||||
|
<div class="box-center">
|
||||||
|
<pan-thumb :image="user.avatar" :height="'100px'" :width="'100px'" :hoverable="false">
|
||||||
|
<div>Hello</div>
|
||||||
|
{{ user.role }}
|
||||||
|
</pan-thumb>
|
||||||
|
</div>
|
||||||
|
<div class="box-center">
|
||||||
|
<div class="user-name text-center">{{ user.name }}</div>
|
||||||
|
<div class="user-role text-center text-muted">{{ user.role | uppercaseFirst }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="user-bio">
|
||||||
|
<div class="user-education user-bio-section">
|
||||||
|
<div class="user-bio-section-header">
|
||||||
|
<svg-icon icon-class="education" /><span>部门信息</span>
|
||||||
|
</div>
|
||||||
|
<div class="user-bio-section-body">
|
||||||
|
<div class="text-muted">
|
||||||
|
{{user.department||"暂无"}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import PanThumb from '@/components/PanThumb'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
PanThumb
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
user: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {
|
||||||
|
name: '',
|
||||||
|
username: '',
|
||||||
|
avatar: '',
|
||||||
|
role: '',
|
||||||
|
department: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.box-center {
|
||||||
|
margin: 0 auto;
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-muted {
|
||||||
|
color: #777;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-profile {
|
||||||
|
.user-name {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box-center {
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-role {
|
||||||
|
padding-top: 10px;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box-social {
|
||||||
|
padding-top: 30px;
|
||||||
|
|
||||||
|
.el-table {
|
||||||
|
border-top: 1px solid #dfe6ec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-follow {
|
||||||
|
padding-top: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-bio {
|
||||||
|
margin-top: 20px;
|
||||||
|
color: #606266;
|
||||||
|
|
||||||
|
span {
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-bio-section {
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 15px 0;
|
||||||
|
|
||||||
|
.user-bio-section-header {
|
||||||
|
border-bottom: 1px solid #dfe6ec;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,78 @@
|
|||||||
|
<template>
|
||||||
|
<div class="" style="margin-top: 20px;">
|
||||||
|
<div v-if="user">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
|
||||||
|
<el-col :span="6" :xs="24">
|
||||||
|
<user-card :user="user" />
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="18" :xs="24">
|
||||||
|
<el-card>
|
||||||
|
<el-tabs v-model="activeTab">
|
||||||
|
<el-tab-pane label="操作日志" name="timeline">
|
||||||
|
<timeline />
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="信息修改" name="account">
|
||||||
|
<account />
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
mapGetters
|
||||||
|
} from 'vuex'
|
||||||
|
import UserCard from './components/UserCard'
|
||||||
|
import Timeline from './components/Timeline'
|
||||||
|
import Account from './components/Account'
|
||||||
|
|
||||||
|
import {
|
||||||
|
getInfo
|
||||||
|
} from '../../api/user.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Profile',
|
||||||
|
components: {
|
||||||
|
UserCard,
|
||||||
|
Timeline,
|
||||||
|
Account
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
user: {},
|
||||||
|
activeTab: 'timeline'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters([
|
||||||
|
'name',
|
||||||
|
'avatar',
|
||||||
|
'roles'
|
||||||
|
])
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getUser()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getUser() {
|
||||||
|
|
||||||
|
getInfo().then(res => {
|
||||||
|
this.user = {
|
||||||
|
name:res.name,
|
||||||
|
username:res.username,
|
||||||
|
role: this.roles.join(' | '),
|
||||||
|
avatar: this.avatar
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Loading…
Reference in new issue