text: import { reactive } from 'vue';
  import { adminLoginStore } from '@/store/index';
  import { ElMessage } from 'element-plus';
  import router from '@/router/index';
  // 管理员登录登录
  class adminLogin {
  
      LoginMsg = reactive({
          userName: '陈涵',
          password: '123456789',
      });
  
      clear() {
          this.LoginMsg.userName = '';
          this.LoginMsg.password = '';
      }
      
      async varifyLogin() {
          if (this.LoginMsg.userName == '' || this.LoginMsg.password == '') {
              ElMessage.warning('请填写完整信息!');
              return;
          }
          const res = await adminLoginStore.dispatch('adminLoginVarify', this.LoginMsg);
          switch (true) {
              case res.code === '0':
                  ElMessage.success(res.msg);
                  window.sessionStorage.setItem('token', res.token);
                  window.sessionStorage.setItem('userName', this.LoginMsg.userName);
                  router.push('/admin/adminMain/userList');
                  break;
              case res === 0: ElMessage.warning('用户名不存在！'); break;
              case res === 2: ElMessage.error('密码错误!'); break;
              default: ElMessage.error('登录出现错误,请稍后重试。'); break;
          }
      }
  }
  
  export default new adminLogin();