保誠-保戶業務員媒合平台
Tomas
2022-02-08 37b34839e943bc619b7ee502886dd78b8927c1ea
update: [帳號設定] update userInfo  store mechanism
修改2個檔案
18 ■■■■■ 已變更過的檔案
PAMapp/pages/login/index.vue 12 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/store/localStorage.ts 6 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/login/index.vue
@@ -355,6 +355,9 @@
  @roleStorage.Mutation
  storageRole!: (role:string) => void;
  @roleStorage.Mutation
  storageUserInfo!: (userInfo: RegisterInfo) => void;
  @Ref('contract') readonly contract!: any;
  connectDevice: 'MOBILE' | 'EMAIL' = 'MOBILE';
@@ -452,7 +455,7 @@
      this.storageRole(Role.USER);
      this.phoneSuccessConfirmVisable = true;
      this.autoRedirect();
      this.storagePhoneOrEmail(this.setRegisterInfo());
      this.storageUserInfo(this.setRegisterInfo());
    }).catch(error => {
      this.checkHttpErrorStatus(error);
    });
@@ -476,7 +479,7 @@
    loginService.register(registerInfo).then(res => {
      this.storageIdToken(res.id_token);
      this.storageRole(Role.USER);
      this.storagePhoneOrEmail(registerInfo);
      this.storageUserInfo(this.setRegisterInfo());
      this.autoRedirect();
      this.registerSuccessConfirmVisable = true;
    }).catch(() => {
@@ -632,11 +635,6 @@
          messageBoxService.showErrorMessage('',error);
          break;
      }
  }
  private storagePhoneOrEmail(registerInfo:RegisterInfo):void{
    const info = {...registerInfo, time: new Date()}
    localStorage.setItem('userInfo',JSON.stringify(info));
  }
  private removeOtpTime() {
PAMapp/store/localStorage.ts
@@ -2,6 +2,7 @@
import { ContactType } from '~/shared/models/enum/ContactType';
import { Role } from '~/shared/models/enum/Role';
import { Selected } from '~/shared/models/quick-filter.model';
import { RegisterInfo } from '~/shared/models/registerInfo';
import { StrictQueryParams } from '~/shared/models/strict-query.model';
@Module
export default class LocalStorage extends VuexModule {
@@ -55,6 +56,11 @@
    return this.notContactAppointmentIdFromMsg;
  }
  @Mutation storageUserInfo(userInfo: RegisterInfo): void {
    localStorage.setItem('userInfo', JSON.stringify(userInfo));
    this.userInfo = localStorage.getItem('userInfo');
  }
  @Mutation storageIdToken(token: string): void {
    localStorage.setItem('id_token', token);
    this.id_token = localStorage.getItem('id_token') ;