| | |
| | | |
| | | //登陆方法 |
| | | const submitForm = (formEl: FormInstance | undefined) => { |
| | | store.$patch({ |
| | | user: null, |
| | | }) |
| | | if (!formEl) return |
| | | formEl.validate((valid) => { |
| | | if (valid) { |
| | |
| | | .then((res) => { |
| | | if (res['code'] == 200) { |
| | | store.$patch({user: res.data}) |
| | | console.log(res.data) |
| | | |
| | | router.push('/main') |
| | | ElMessage.success(t('login.loginSuccessful')) |
| | | } else { |
| | | ElMessage.error(res['msg']) |
| | | // ElMessage.error(res['msg']) |
| | | store.$patch({ |
| | | user: null, |
| | | }) |
| | |
| | | <el-button :loading="loginLoadings" |
| | | type="primary" |
| | | native-type="submit" |
| | | style="width: 80px;" |
| | | @click="submitForm(ruleFormRef)" |
| | | @keyup.enter.native="keyDown(e)" |
| | | plain>{{ $t('login.login') }} |
| | | </el-button> |
| | | <el-button :loading="registerLoadings" |
| | | <!-- <el-button :loading="registerLoadings" |
| | | type="primary" |
| | | @click="register" |
| | | plain>{{ $t('login.register') }} |
| | | </el-button> |
| | | </el-button> --> |
| | | |
| | | </el-form-item> |
| | | </div> |