|
|
@@ -6,39 +6,118 @@
|
|
|
</div>
|
|
|
<div class="right">
|
|
|
<div class="txt">项目资料管理系统</div>
|
|
|
- <div class="user">
|
|
|
- <span>用户名</span>
|
|
|
+ <div class="user" @click="cut = !cut">
|
|
|
+ <span>{{ userInfo.realName }}</span>
|
|
|
<img src="@/assets/img/user.jpg" alt="" />
|
|
|
+ <!-- 下箭头 -->
|
|
|
+ <div class="pull_down" v-if="cut"></div>
|
|
|
+ <div class="pull_up" v-else></div>
|
|
|
</div>
|
|
|
+ <!-- 点击箭头出来的ul -->
|
|
|
+ <ul class="user_handle" v-show="cut">
|
|
|
+ <li @click="isShow = true">修改密码</li>
|
|
|
+ <li @click="outLogin">退出登录</li>
|
|
|
+ </ul>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="conten">
|
|
|
- <div class="leftTab">
|
|
|
- <div class="title">数据管理</div>
|
|
|
- <ul>
|
|
|
- <li v-for="item in tabList1" :key="item.id" :class="{active:$route.meta.myInd===item.id}" @click="skip(item.id,item.path)">{{item.name}}</li>
|
|
|
- </ul>
|
|
|
- <div class="title">系统管理</div>
|
|
|
- <ul>
|
|
|
- <li v-for="item in tabList2" :key="item.id" :class="{active:$route.meta.myInd===item.id}" @click="skip(item.id,item.path)">{{item.name}}</li>
|
|
|
- </ul>
|
|
|
- </div>
|
|
|
- <!-- 右侧内容 -->
|
|
|
- <Router-view style="width: 1630px;"/>
|
|
|
+ <div class="leftTab">
|
|
|
+ <div class="title">数据管理</div>
|
|
|
+ <ul>
|
|
|
+ <li
|
|
|
+ v-for="item in tabList1"
|
|
|
+ :key="item.id"
|
|
|
+ :class="{ active: $route.meta.myInd === item.id }"
|
|
|
+ @click="skip(item.id, item.path)"
|
|
|
+ >
|
|
|
+ {{ item.name }}
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ <div class="title">系统管理</div>
|
|
|
+ <ul>
|
|
|
+ <li
|
|
|
+ v-for="item in tabList2"
|
|
|
+ :key="item.id"
|
|
|
+ :class="{ active: $route.meta.myInd === item.id }"
|
|
|
+ @click="skip(item.id, item.path)"
|
|
|
+ >
|
|
|
+ {{ item.name }}
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ <!-- 右侧内容 -->
|
|
|
+ <Router-view style="width: 1630px" @click.native="cut = false" />
|
|
|
</div>
|
|
|
+ <!-- 点击修改密码出现弹窗 -->
|
|
|
+ <el-dialog title="修改密码" :visible.sync="isShow" @close="btnX()">
|
|
|
+ <el-form :model="form" label-width="100px" :rules="rules" ref="ruleForm">
|
|
|
+ <el-form-item label="旧密码:" prop="oldPassword">
|
|
|
+ <el-input
|
|
|
+ v-model="form.oldPassword"
|
|
|
+ placeholder="请输入"
|
|
|
+ show-password
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="新密码:" prop="newPassword">
|
|
|
+ <el-input
|
|
|
+ v-model="form.newPassword"
|
|
|
+ placeholder="请输入"
|
|
|
+ show-password
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="确定新密码:" prop="checkPass">
|
|
|
+ <el-input
|
|
|
+ v-model="form.checkPass"
|
|
|
+ placeholder="请输入"
|
|
|
+ show-password
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="btnX">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="btnOk">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
// 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
|
|
// 例如:import 《组件名称》 from '《组件路径》';
|
|
|
-
|
|
|
+import { updatePwd } from '@/apis/tab4'
|
|
|
export default {
|
|
|
// import引入的组件需要注入到对象中才能使用
|
|
|
components: {},
|
|
|
data () {
|
|
|
// 这里存放数据
|
|
|
+ const validatePass2 = (rule, value, callback) => {
|
|
|
+ if (value !== this.form.newPassword) {
|
|
|
+ callback(new Error('两次输入密码不一致!'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
return {
|
|
|
+ // 修改密码
|
|
|
+ form: {
|
|
|
+ oldPassword: '',
|
|
|
+ newPassword: '',
|
|
|
+ checkPass: ''
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ checkPass: [
|
|
|
+ { validator: validatePass2, trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ oldPassword: [
|
|
|
+ { required: true, message: '不能为空', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ newPassword: [
|
|
|
+ { required: true, message: '不能为空', trigger: 'blur' }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ isShow: false,
|
|
|
+ cut: false,
|
|
|
+ userInfo: {},
|
|
|
tabList1: [
|
|
|
{ id: 0, name: '项目资料', path: '/layout/tab1' },
|
|
|
{ id: 1, name: '文物案例', path: '/layout/tab2' },
|
|
|
@@ -56,12 +135,59 @@ export default {
|
|
|
watch: {},
|
|
|
// 方法集合
|
|
|
methods: {
|
|
|
+ // 修改密码点击取消
|
|
|
+ btnX () {
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
|
+ this.cut = false
|
|
|
+ this.isShow = false
|
|
|
+ this.form = {
|
|
|
+ oldPassword: '',
|
|
|
+ newPassword: '',
|
|
|
+ checkPass: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 修改密码点击确定
|
|
|
+ async btnOk () {
|
|
|
+ await this.$refs.ruleForm.validate()
|
|
|
+ try {
|
|
|
+ await updatePwd(this.form)
|
|
|
+ this.$message.success('修改成功')
|
|
|
+ localStorage.clear('SWKK_token')
|
|
|
+ localStorage.clear('SWKK_userInfo')
|
|
|
+ this.$router.push('/')
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error('旧密码错误')
|
|
|
+ }
|
|
|
+ },
|
|
|
skip (id, url) {
|
|
|
this.$router.push(url).catch(() => {})
|
|
|
+ },
|
|
|
+ // 点击退出登录
|
|
|
+ outLogin () {
|
|
|
+ this.cut = false
|
|
|
+ this.$confirm('确定退出吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ localStorage.clear('SWKK_token')
|
|
|
+ localStorage.clear('SWKK_userInfo')
|
|
|
+ this.$router.push('/')
|
|
|
+ this.$message.success('退出成功!')
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message.info('已取消')
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
// 生命周期 - 创建完成(可以访问当前this实例)
|
|
|
- created () {},
|
|
|
+ created () {
|
|
|
+ // 获取用户信息
|
|
|
+ const res = localStorage.getItem('SWKK_userInfo')
|
|
|
+ // console.log(999, JSON.parse(res))
|
|
|
+ this.userInfo = JSON.parse(res)
|
|
|
+ },
|
|
|
// 生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
mounted () {},
|
|
|
beforeCreate () {}, // 生命周期 - 创建之前
|
|
|
@@ -87,6 +213,7 @@ export default {
|
|
|
text-align: center;
|
|
|
}
|
|
|
.right {
|
|
|
+ position: relative;
|
|
|
flex: 1;
|
|
|
padding: 0 60px;
|
|
|
height: 100%;
|
|
|
@@ -98,6 +225,8 @@ export default {
|
|
|
font-weight: 700;
|
|
|
}
|
|
|
.user {
|
|
|
+ cursor: pointer;
|
|
|
+ position: relative;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
img {
|
|
|
@@ -107,45 +236,83 @@ export default {
|
|
|
border-radius: 50%;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
+ .pull_down {
|
|
|
+ position: absolute;
|
|
|
+ right: -24px;
|
|
|
+ bottom: 5px;
|
|
|
+ display: inline-block;
|
|
|
+ width: 0;
|
|
|
+ height: 0;
|
|
|
+ border-left: 8px solid transparent;
|
|
|
+ border-right: 8px solid transparent;
|
|
|
+ border-bottom: 8px solid black;
|
|
|
+ }
|
|
|
+ .pull_up {
|
|
|
+ cursor: pointer;
|
|
|
+ position: absolute;
|
|
|
+ right: -24px;
|
|
|
+ bottom: 5px;
|
|
|
+ display: inline-block;
|
|
|
+ width: 0;
|
|
|
+ height: 0;
|
|
|
+ border-left: 8px solid transparent;
|
|
|
+ border-right: 8px solid transparent;
|
|
|
+ border-top: 8px solid black;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .user_handle {
|
|
|
+ z-index: 999;
|
|
|
+ padding: 10px 40px;
|
|
|
+ position: absolute;
|
|
|
+ right: 0;
|
|
|
+ bottom: -102px;
|
|
|
+ background-color: #f6f8f9;
|
|
|
+ li {
|
|
|
+ cursor: pointer;
|
|
|
+ margin: 10px 0;
|
|
|
+ }
|
|
|
+ li:hover {
|
|
|
+ color: #dc3545;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- .leftTab {
|
|
|
- font-size: 24px;
|
|
|
- color: #fff;
|
|
|
- padding: 30px 25px;
|
|
|
- width: 290px;
|
|
|
- height: calc(100vh - 60px);
|
|
|
- min-height: 870px;
|
|
|
- background-color: rgba(0, 0, 0, 0.8);
|
|
|
- .title {
|
|
|
- margin-top: 30px;
|
|
|
+}
|
|
|
+.leftTab {
|
|
|
+ font-size: 24px;
|
|
|
+ color: #fff;
|
|
|
+ padding: 30px 25px;
|
|
|
+ width: 290px;
|
|
|
+ height: calc(100vh - 60px);
|
|
|
+ min-height: 870px;
|
|
|
+ background-color: rgba(0, 0, 0, 0.8);
|
|
|
+ .title {
|
|
|
+ margin-top: 30px;
|
|
|
+ width: 230px;
|
|
|
+ height: 60px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ background-color: #dc3545;
|
|
|
+ }
|
|
|
+ ul {
|
|
|
+ margin-top: 15px;
|
|
|
+ li {
|
|
|
+ cursor: pointer;
|
|
|
width: 230px;
|
|
|
height: 60px;
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
- background-color: #dc3545;
|
|
|
}
|
|
|
- ul {
|
|
|
- margin-top: 15px;
|
|
|
- li {
|
|
|
- cursor: pointer;
|
|
|
- width: 230px;
|
|
|
- height: 60px;
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
- }
|
|
|
- li:hover{
|
|
|
- background-color:rgba(220, 53, 69, .6) ;
|
|
|
- }
|
|
|
- .active {
|
|
|
- background-color:rgba(220, 53, 69, .6) ;
|
|
|
- }
|
|
|
+ li:hover {
|
|
|
+ background-color: rgba(220, 53, 69, 0.6);
|
|
|
+ }
|
|
|
+ .active {
|
|
|
+ background-color: rgba(220, 53, 69, 0.6);
|
|
|
}
|
|
|
}
|
|
|
- .conten{
|
|
|
- display: flex;
|
|
|
- }
|
|
|
+}
|
|
|
+.conten {
|
|
|
+ display: flex;
|
|
|
}
|
|
|
</style>
|