|
@@ -33,9 +33,62 @@
|
|
|
<span style="display:block;"
|
|
|
@click="logout">退出</span>
|
|
|
</el-dropdown-item>
|
|
|
+ <el-dropdown-item>
|
|
|
+ <span style="display:block;"
|
|
|
+ @click="resetPassWord">修改密码</span>
|
|
|
+ </el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
</el-dropdown>
|
|
|
</div>
|
|
|
+ <el-dialog title="修改密码"
|
|
|
+ width="500px"
|
|
|
+ append-to-body
|
|
|
+ :visible.sync="resetVisible">
|
|
|
+ <el-form :model="resetForm"
|
|
|
+ label-position='right'
|
|
|
+ label-width="100px"
|
|
|
+ ref='pwdForm'>
|
|
|
+ <el-form-item label="手机号"
|
|
|
+ prop="phone"
|
|
|
+ :rules="[{ required: true, message: '手机号不能为空',trigger: 'blur'},{pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号',trigger: 'blur' }]">
|
|
|
+ <el-input v-model="resetForm.phone"
|
|
|
+ style="width:180px"
|
|
|
+ autocomplete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="新密码"
|
|
|
+ :rules="[{ required: true, message: '密码不能为空',trigger: 'blur'},{pattern:/^[\w]{6,20}$/,message:'密码为6-20位',trigger: 'blur'}]"
|
|
|
+ prop="password">
|
|
|
+ <el-input v-model="resetForm.password"
|
|
|
+ type='password'
|
|
|
+ style="width:180px"
|
|
|
+ autocomplete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="再次输入"
|
|
|
+ :rules="[{ required: true, message: '密码不能为空',trigger: 'blur'},{pattern:/^[\w]{6,20}$/,message:'密码为6-20位',trigger: 'blur'}]"
|
|
|
+ prop="password2">
|
|
|
+ <el-input v-model="resetForm.password2"
|
|
|
+ type='password'
|
|
|
+ style="width:180px"
|
|
|
+ autocomplete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="验证码"
|
|
|
+ :rules="[{ required: true, message: '验证码不能为空',trigger: 'blur'}]"
|
|
|
+ prop="authCode"
|
|
|
+ style="">
|
|
|
+ <el-input v-model="resetForm.authCode"
|
|
|
+ style="width:180px"
|
|
|
+ autocomplete="off"></el-input>
|
|
|
+ <el-button :disabled="isDisable"
|
|
|
+ @click="getCode">{{ btnName }}</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer"
|
|
|
+ class="dialog-footer">
|
|
|
+ <el-button @click="resetVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary"
|
|
|
+ @click="submitResetPassWord">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -43,12 +96,22 @@
|
|
|
import { mapGetters } from "vuex";
|
|
|
// import Breadcrumb from '@/components/Breadcrumb'
|
|
|
// import Hamburger from '@/components/Hamburger'
|
|
|
-
|
|
|
+import { resetPassword } from '@/api/buildTeam'
|
|
|
export default {
|
|
|
data () {
|
|
|
return {
|
|
|
username: '',
|
|
|
- organName: this.$store.getters.organName
|
|
|
+ organName: this.$store.getters.organName,
|
|
|
+ resetVisible: false,
|
|
|
+ resetForm: {
|
|
|
+ phone: '',
|
|
|
+ authCode: '',
|
|
|
+ password: '',
|
|
|
+ password2: ''
|
|
|
+ },
|
|
|
+ isDisable: false, // 是否允许发送验证码
|
|
|
+ timerCount: 60,
|
|
|
+ btnName: '获取验证码'
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
@@ -75,6 +138,58 @@ export default {
|
|
|
},
|
|
|
gotoRecode () {
|
|
|
this.$router.push('/journal/journal')
|
|
|
+ },
|
|
|
+ resetPassWord () {
|
|
|
+ this.resetVisible = true;
|
|
|
+ },
|
|
|
+ submitResetPassWord () {
|
|
|
+ if (this.resetForm.password !== this.resetForm.password2) {
|
|
|
+ this.$message.error('两次密码必须相同')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$refs['pwdForm'].validate(res => {
|
|
|
+ if (res) {
|
|
|
+ // 发请求
|
|
|
+ resetPassword({ authCode: this.resetForm.authCode, mobile: this.resetForm.phone, newPassword: this.resetForm.password }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ // 修改成功
|
|
|
+ this.$message.success('修改成功')
|
|
|
+ this.logout()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getCode () {
|
|
|
+ // 获取验证码
|
|
|
+ if (!this.isDisable) {
|
|
|
+ this.isDisable = true;
|
|
|
+ // 发请求成功后开启定时器
|
|
|
+ // 发送验证码
|
|
|
+ let timer = setInterval(res => {
|
|
|
+ if (this.timerCount <= 0) {
|
|
|
+ clearInterval(timer)
|
|
|
+ this.isDisable = false;
|
|
|
+ this.btnName = '获取验证码';
|
|
|
+ this.timerCount = 60;
|
|
|
+ } else {
|
|
|
+ this.timerCount--;
|
|
|
+ this.btnName = `${this.timerCount}s后重试`
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ resetVisible (val) {
|
|
|
+ if (!val) {
|
|
|
+ this.resetForm = {
|
|
|
+ phone: '',
|
|
|
+ authCode: '',
|
|
|
+ password: '',
|
|
|
+ password2: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|