|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | import crypto from 'crypto' | 
|---|
|  |  |  | import userService from "../service/UserService"; | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: "changePassword", | 
|---|
|  |  |  | props: {}, | 
|---|
|  |  |  | 
|---|
|  |  |  | onSubmit: function () { | 
|---|
|  |  |  | this.$axios({ | 
|---|
|  |  |  | method: 'post', | 
|---|
|  |  |  | url:"./api/user/changePassword", | 
|---|
|  |  |  | url:"/api/user/changePassword", | 
|---|
|  |  |  | params: { | 
|---|
|  |  |  | oldPassword: crypto.createHash('md5').update(this.oldPassword, "utf8").digest('hex'), | 
|---|
|  |  |  | password: this.newPassword | 
|---|
|  |  |  | 
|---|
|  |  |  | this.showDialog = false; | 
|---|
|  |  |  | setTimeout(()=>{ | 
|---|
|  |  |  | // 删除cookie,回到登录页面 | 
|---|
|  |  |  | this.$cookies.remove("session"); | 
|---|
|  |  |  | userService.clearUserInfo(); | 
|---|
|  |  |  | this.$router.push('/login'); | 
|---|
|  |  |  | this.sseSource.close(); | 
|---|
|  |  |  | },800) | 
|---|