Merge branch 'master' of https://192.168.0.10:8443/r/pcalife/PAM
| | |
| | | import { Vue, Component , namespace } from 'nuxt-property-decorator'; |
| | | import { AxiosError } from 'axios'; |
| | | import { Role } from '~/shared/models/enum/role'; |
| | | import ErrorMessageBox from '~/shared/errorService'; |
| | | import messageBoxService from '~/shared/services/message-box.service'; |
| | | import loginService from '~/shared/services/login.service' |
| | | |
| | | const roleStorage = namespace('localStorage'); |
| | |
| | | } |
| | | |
| | | public sendInfo():void{ |
| | | this.isAlreadyDone ? this.verify() : ErrorMessageBox('è«ç¢ºèªå¸³èãå¯ç¢¼ä»¥åé©è碼æ¯å¦å¡«å¯«å®ç¢'); |
| | | this.isAlreadyDone ? this.verify() : messageBoxService.showErrorMessage('è«ç¢ºèªå¸³èãå¯ç¢¼ä»¥åé©è碼æ¯å¦å¡«å¯«å®ç¢'); |
| | | } |
| | | |
| | | |
| | |
| | | }else{ |
| | | this.clearValue(); |
| | | this.regenerateImgOfVerification(); |
| | | ErrorMessageBox('é©è碼輸å
¥é¯èª¤'); |
| | | messageBoxService.showErrorMessage('é©è碼輸å
¥é¯èª¤'); |
| | | } |
| | | }); |
| | | } |
| | |
| | | switch (error.response.status) { |
| | | case 401: |
| | | const errorMsg = error.response.data.detail; |
| | | ErrorMessageBox(errorMsg); |
| | | messageBoxService.showErrorMessage(errorMsg); |
| | | break; |
| | | |
| | | default: |
| | | ErrorMessageBox('',error); |
| | | messageBoxService.showErrorMessage('',error); |
| | | break; |
| | | } |
| | | } |
| | |
| | | <script lang="ts"> |
| | | import { namespace } from 'nuxt-property-decorator'; |
| | | import { Vue, Component, Ref } from 'vue-property-decorator'; |
| | | import ErrorMessageBox from '~/shared/errorService'; |
| | | import { OtpErrorCode } from '~/shared/models/enum/otpErrorCode'; |
| | | import { Role } from '~/shared/models/enum/role'; |
| | | import { LoginRequest } from '~/shared/models/loginRequest.model'; |
| | |
| | | import { OtpInfo } from '~/shared/models/otpInfo.model'; |
| | | import { RegisterInfo } from '~/shared/models/registerInfo'; |
| | | import loginService from '~/shared/services/login.service'; |
| | | import messageBoxService from '~/shared/services/message-box.service'; |
| | | |
| | | const roleStorage = namespace('localStorage'); |
| | | |
| | |
| | | this.startOtpCount(type); |
| | | } else { |
| | | const errorMsg = OtpErrorCode[otpInfo.failCode] ? OtpErrorCode[otpInfo.failCode]:'OTP系統é¯èª¤'; |
| | | ErrorMessageBox(errorMsg); |
| | | messageBoxService.showErrorMessage(errorMsg); |
| | | } |
| | | }); |
| | | }; |
| | |
| | | switch (error.response.status) { |
| | | case 401: |
| | | const errorMsg = OtpErrorCode[error.response?.data?.detail] ? OtpErrorCode[error.response?.data?.detail]:'OTP系統é¯èª¤'; |
| | | ErrorMessageBox(errorMsg); |
| | | messageBoxService.showErrorMessage(errorMsg); |
| | | break; |
| | | case 403: |
| | | this.registerDialogVisible = true; |
| | |
| | | }, 1000); |
| | | break; |
| | | default: |
| | | ErrorMessageBox('',error); |
| | | messageBoxService.showErrorMessage('',error); |
| | | break; |
| | | } |
| | | } |
| | |
| | | import { AxiosRequestConfig, AxiosError, AxiosResponse} from 'axios'; |
| | | import ErrorMessageBox from '../errorService'; |
| | | import axios from 'axios'; |
| | | import _ from 'lodash'; |
| | | |
| | | import messageBoxService from './message-box.service'; |
| | | |
| | | const notRequireInterceptorErrorUrl = [ |
| | | '/otp/verify', |
| | |
| | | if (!_.includes(notRequireInterceptorErrorUrl, error.config.url)) { |
| | | switch (error.response.status) { |
| | | case 401: |
| | | Promise.all([ErrorMessageBox('ç»å
¥é¾æ'), window.$nuxt.$store.dispatch('localStorage/actionStorageClear')]).then(() => { |
| | | Promise.all([messageBoxService.showErrorMessage('ç»å
¥é¾æ'), window.$nuxt.$store.dispatch('localStorage/actionStorageClear')]).then(() => { |
| | | _.isEqual(window.$nuxt.$route.name, 'index') ? location.reload() : window.$nuxt.$router.push('/'); |
| | | }); |
| | | break; |
| | | |
| | | default: |
| | | ErrorMessageBox('', error); |
| | | messageBoxService.showErrorMessage('', error); |
| | | break; |
| | | } |
| | | } |
¤ñ¹ï·sÀÉ®× |
| | |
| | | import { MessageBox } from 'element-ui'; |
| | | import { MessageBoxData } from "element-ui/types/message-box"; |
| | | import _ from "lodash"; |
| | | |
| | | class MessageBoxService { |
| | | |
| | | showErrorMessage(errorMsg?:string, errorObj?: any): Promise<MessageBoxData> { |
| | | const messageBoxConfig = { |
| | | message: errorMsg |
| | | ? `${this.breakTextByComma(errorMsg)}` |
| | | : `<div class="message-header"> 系統ç¼çé¯èª¤: ${errorObj?.response?.status} </div> |
| | | <div class="message-content">${errorObj?.response?.data?.detail}</div>`, |
| | | dangerouslyUseHTMLString: true, |
| | | showClose:false, |
| | | showConfirmButton:true, |
| | | confirmButtonText:'確èª', |
| | | customClass:'pam-message-box', |
| | | closeOnClickModal:false, |
| | | }; |
| | | return MessageBox(messageBoxConfig); |
| | | } |
| | | |
| | | // æ«æç¨éè廿·è¡ |
| | | private breakTextByComma(errorMsg:string):string{ |
| | | return _.split(errorMsg,"ï¼").join('<br>'); |
| | | } |
| | | |
| | | } |
| | | |
| | | export default new MessageBoxService(); |