|  |  |  | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | import { mapMutations } from 'vuex' | 
|---|
|  |  |  | import { getCaptcha, loginByPassword } from '@/api/system/common' | 
|---|
|  |  |  | import Cookies from "js-cookie"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: 'Login', | 
|---|
|  |  |  | 
|---|
|  |  |  | code: this.captcha.value.trim(), | 
|---|
|  |  |  | uuid: this.captcha.uuid | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .then(() => { | 
|---|
|  |  |  | .then((res) => { | 
|---|
|  |  |  | // window.location.href = process.env.VUE_APP_CONTEXT_PATH | 
|---|
|  |  |  | Cookies.set('dm_user_token',res) | 
|---|
|  |  |  | window.location.reload() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(e => { | 
|---|
|  |  |  | this.refreshCaptcha() | 
|---|
|  |  |  | this.$tip.apiFailed(e) | 
|---|
|  |  |  | // this.$tip.apiFailed(e) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .finally(() => { | 
|---|
|  |  |  | this.loading = false | 
|---|