From 75954b2d3519560691726fd043b99737524491fb Mon Sep 17 00:00:00 2001 From: zuozhengqing <a13193816592@163.com> Date: 星期一, 05 二月 2024 19:12:46 +0800 Subject: [PATCH] 合并dev --- src/components/layout/components/appHeader/components/updatePassWord.vue | 182 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 182 insertions(+), 0 deletions(-) diff --git a/src/components/layout/components/appHeader/components/updatePassWord.vue b/src/components/layout/components/appHeader/components/updatePassWord.vue new file mode 100644 index 0000000..8d089bf --- /dev/null +++ b/src/components/layout/components/appHeader/components/updatePassWord.vue @@ -0,0 +1,182 @@ +<template> + <div> + <el-dialog + title="淇敼瀵嗙爜" + :visible.sync="editConfig.dialogVisible" + width="30%" + :before-close="handleClose"> + <el-form :label-position="labelPosition" :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm"> + <el-form-item label="鏃у瘑鐮�:" prop="oldPass"> + <el-input type="password" clearable v-model="ruleForm.oldPass" autocomplete="off"></el-input> + </el-form-item> + <el-form-item label="鏂板瘑鐮�:" prop="pass"> + <el-input type="password" clearable v-model="ruleForm.pass" autocomplete="off"></el-input> + </el-form-item> + <el-form-item label="纭瀵嗙爜:" prop="checkPass"> + <el-input type="password" clearable v-model="ruleForm.checkPass" autocomplete="off"></el-input> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="submitForm('ruleForm')" style="margin-bottom:20px;">纭</el-button> + </el-form-item> + </el-form> + </el-dialog> + </div> +</template> + +<script> +import { modifiedPwd } from "@/api/admin/user"; +export default { + props: { + editCommonConfig: { + type: Object, + default: () => { + return { + dialogVisible:false, + userId:"", + }; + }, + }, + }, + data() { + var validatePass = (rule, value, callback) => { + if (value === '') { + callback(new Error('璇疯緭鍏ユ棫瀵嗙爜')); + }else{ + callback(); + } + }; + var validatePass1 = (rule, value, callback) => { + if (value === '') { + callback(new Error('璇疯緭鍏ユ柊瀵嗙爜')); + } else { + if (this.ruleForm.checkPass !== '') { + this.$refs.ruleForm.validateField('checkPass'); + } + callback(); + } + }; + var validatePass2 = (rule, value, callback) => { + if (value === '') { + callback(new Error('璇峰啀娆¤緭鍏ュ瘑鐮�')); + } else if (value !== this.ruleForm.pass) { + callback(new Error('涓ゆ杈撳叆瀵嗙爜涓嶄竴鑷�!')); + } else { + callback(); + } + }; + return { + editConfig:this.editCommonConfig, + // dialogVisible: false + ruleForm: { + oldPass:'', + pass: '', + checkPass: '', + }, + rules: { + oldPass: [ + { validator: validatePass, trigger: 'blur', required: true, } + ], + pass: [ + { validator: validatePass1, trigger: 'blur', required: true, } + ], + checkPass: [ + { validator: validatePass2, trigger: 'blur', required: true, } + ], + }, + labelPosition:"left", + userId : '', + }; + }, + computed: { + + }, + created() { + + }, + mounted() { + }, + watch: { + + }, + methods: { + // + environmentType(){ + let type + if (location.href.includes('192.168.20.119')) { + type = 'test' + } else if (location.href.includes('192.168') || location.href.includes('localhost')) { + type = 'dev' + } else { + type = 'prod' + } + return type + }, + // + getApsPage(){ + // 棣栭〉閮ㄧ讲鍦ㄥ悇涓幆澧冪殑绔彛 + const loginPathMap = { + prod:`//${window.location.hostname}:9080`, + test:`//192.168.20.119:9080`, + // 鎯宠烦鍒版湰鍦板惎鍔ㄧ殑鐧诲綍椤电殑璇濋渶瑕佹妸dev鏀规垚浣犳湰鍦伴」鐩矾寰� + dev: `//192.168.8.108:8080` + } + + return loginPathMap[this.environmentType()] + }, + handleClose(done){ + done(); + }, + modifiedPwd(params){ + modifiedPwd(params).then((res)=>{ + if(res.code==200){ + this.editConfig.dialogVisible=false + alert("瀵嗙爜淇敼鎴愬姛,璇烽噸鏂扮櫥褰�!") + window.location = this.getApsPage()+'/login' + } + }) + }, + submitForm(formName) { + this.$refs[formName].validate((valid) => { + if (valid) { + console.log(this.ruleForm,"鐪嬬湅琛ㄥ崟") + this.modifiedPwd({ + userId:this.editConfig.userId, + oldPwd:this.ruleForm.oldPass, + newPwd:this.ruleForm.pass, + }) + + } else { + console.log('error submit!!'); + return false; + } + }); + }, + + }, + components: { + + }, +}; +</script> + +<style scoped lang="scss"> +.el-form{ + margin-top:20px; +} +::v-deep { + .el-form-item__content{ + display: flex; + flex-direction: row-reverse; + } + .el-dialog__header{ + .el-dialog__title{ + font-size:18px; + + } + } + .el-form{ + margin:20px; + } + +} +</style> -- Gitblit v1.8.0