|
@@ -5,10 +5,17 @@
|
|
|
>
|
|
|
<el-container>
|
|
|
<!-- 导航栏 -->
|
|
|
- <el-header>
|
|
|
+ <el-header
|
|
|
+ :style="{backgroundImage:'url('+nav.icon+')'}"
|
|
|
+ style="background-size:calc(40px * 944 / 84 ) 40px ; background-repeat:no-repeat;background-position:200px"
|
|
|
+ >
|
|
|
<div class="left">
|
|
|
- <el-image :src="nav.icon" />
|
|
|
<span>人员能力评估系统</span>
|
|
|
+ <!-- 944 84 -->
|
|
|
+ <!-- <el-image
|
|
|
+ style="height:50px;width:calc(50px * 944 / 84);padding-left:10px;"
|
|
|
+ :src="nav.icon"
|
|
|
+ /> -->
|
|
|
</div>
|
|
|
<div class="right">
|
|
|
<div
|
|
@@ -24,11 +31,64 @@
|
|
|
<slot />
|
|
|
</el-main>
|
|
|
</el-container>
|
|
|
+ <!-- 修改密码 -->
|
|
|
+ <el-dialog
|
|
|
+ title="提示"
|
|
|
+ :visible.sync="centerDialogVisible"
|
|
|
+ width="500px"
|
|
|
+ center
|
|
|
+ >
|
|
|
+ <el-form
|
|
|
+ :rules="rules"
|
|
|
+ :model="value"
|
|
|
+ ref="update"
|
|
|
+ label-width="100px"
|
|
|
+ >
|
|
|
+ <el-form-item
|
|
|
+ label="旧密码"
|
|
|
+ prop="old_password"
|
|
|
+ >
|
|
|
+ <el-input v-model="value.old_password" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="新密码"
|
|
|
+ prop="new_password"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ type="password"
|
|
|
+ v-model="value.new_password"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="确认密码"
|
|
|
+ prop="confirm_password"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ type="password"
|
|
|
+ v-model="value.confirm_password"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="submitForm('update')"
|
|
|
+ >提交</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-dialog>
|
|
|
+ <!-- logo -->
|
|
|
+ <!-- <img
|
|
|
+ src="@/assets/login/2.jpg"
|
|
|
+ class="logo"
|
|
|
+ style="width:200px;position:fixed;bottom:50px;right:50px;"
|
|
|
+ alt=""
|
|
|
+ > -->
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import icon from "@/assets/home/u25.png"
|
|
|
+import icon from "@/assets/login/1.png";
|
|
|
+import Global from "@/api/global.js"
|
|
|
export default {
|
|
|
props: {
|
|
|
Type: {
|
|
@@ -37,41 +97,75 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
data () {
|
|
|
+ var validatorAFunc = (rule, value, callback) => {
|
|
|
+ this.value.old_password == value ? callback(new Error("新密码不能和记密码一致!")) :
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ var validatorBFunc = (rule, value, callback) => {
|
|
|
+ this.value.new_password !== value ? callback(new Error("两次密码不一致")) :
|
|
|
+ callback();
|
|
|
+ }
|
|
|
return {
|
|
|
// 导航栏
|
|
|
nav: {
|
|
|
icon,
|
|
|
btns: [{
|
|
|
- name: "账户设置", success (that) {
|
|
|
- alert("账户设置")
|
|
|
+ name: "用户 - " + sessionStorage.getItem("username"), success () {
|
|
|
+ this.centerDialogVisible = true;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
name: "退出登录",
|
|
|
- success (that) {
|
|
|
+ success () {
|
|
|
sessionStorage.clear();
|
|
|
- that.$router.push("/login")
|
|
|
+ this.$router.push("/login")
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
+ // 修改密码
|
|
|
+ centerDialogVisible: false,
|
|
|
+ value: {
|
|
|
+ old_password: '',
|
|
|
+ new_password: '',
|
|
|
+ confirm_password: "",
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ old_password: [
|
|
|
+ { required: true, message: "旧密码不能为空!", trigger: "blur" },
|
|
|
+ { min: 4, message: "旧密码最短4个字符", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ new_password: [
|
|
|
+ { required: true, message: "新密码不能为空!", trigger: "blur" },
|
|
|
+ { min: 4, message: "新密码最短4个字符!", trigger: "blur" },
|
|
|
+ { validator: validatorAFunc, trigger: "blur" }
|
|
|
+ ],
|
|
|
+ confirm_password: [
|
|
|
+ { required: true, message: "确认密码不能为空!", trigger: "blur" },
|
|
|
+ { validator: validatorBFunc, trigger: "blur" }
|
|
|
+ ]
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- Success (func) {
|
|
|
- let that = this;
|
|
|
- func(that)
|
|
|
- },
|
|
|
- // 正式考试 严格模式
|
|
|
- Static () {
|
|
|
- // window.onbeforeunload = function (e) {
|
|
|
- // var e = window.event || e;
|
|
|
- // e.returnValue = ("确定离开当前页面吗?");
|
|
|
- // }
|
|
|
- // console.log(this.Type, this.$refs)
|
|
|
- // this.$refs["basic"].addEventListener("mouseleave", function () {
|
|
|
- // alert("123")
|
|
|
- // })
|
|
|
+ Success (func) { func.bind(this)() },
|
|
|
+ // 提交数据
|
|
|
+ submitForm (refName) {
|
|
|
+ this.$refs[refName].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ Global.update(this.value).then(res => {
|
|
|
+ this.$message({ type: "success", message: "密码已修改!" });
|
|
|
+ sessionStorage.clear();
|
|
|
+ this.value = {
|
|
|
+ old_password: '',
|
|
|
+ new_password: '',
|
|
|
+ confirm_password: "",
|
|
|
+ }
|
|
|
+ this.centerDialogVisible = false;
|
|
|
+ this.$router.push("/login")
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|
|
@@ -80,8 +174,17 @@ export default {
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="less" >
|
|
|
+.logo {
|
|
|
+ display: none;
|
|
|
+}
|
|
|
+@media screen and (min-width: 1680px) {
|
|
|
+ .logo {
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+}
|
|
|
#basic {
|
|
|
min-height: 100vh;
|
|
|
+ position: relative;
|
|
|
.el-container {
|
|
|
// h:60 p:0 20
|
|
|
.el-header {
|