'-'
zhangwei
2025-07-07 85428f0bf3bbf08d65200cffc38dd1e96af34da6
src/views/login/index.vue
@@ -110,7 +110,8 @@
  hideTenantForLogin: false,
  expirySeconds: 60, // 验证码过期时间
  phoneSeconds: 0, // 手机验证码倒计时
  roleList: []
  roleList: [],
  nowRole: {}
});
// 验证码过期计时器
let timer: any = null;
@@ -119,7 +120,7 @@
// 页面初始化
onMounted(async () => {
  // 若URL带有Token参数(第三方登录)
  const accessToken = route.query.token;
  // if (accessToken) await saveTokenAndInitRoutes(accessToken);
  // watch(
  //   () => themeConfig.value.isLoaded,
@@ -134,6 +135,13 @@
  getCaptcha();
  exRole().then(res => {
    state.roleList = res.result;
    const role = route.query;
    if (role.code) {
      state.nowRole = role;
    } else {
      state.nowRole = state.roleList[0];
    }
    state.ruleForm.exRoleCode = state.nowRole?.code;
  });
  // 注册验证码过期计时器
  // if (state.captchaEnabled) {
@@ -170,13 +178,18 @@
          if (res.code == 200) {
            // 获取后端路由
            return initRouter().then(() => {
              disabled.value = true;
              router
                .push(getTopMenu(true)?.path)
                .then(() => {
                  message("登录成功", { type: "success" });
                })
                .finally(() => (disabled.value = false));
              console.log(res, "=-=-=-=");
              if (!res.result.exRoles.hasFlsh) {
                disabled.value = true;
                router
                  .replace("registernav")
                  .then(() => {
                    message("登录成功", { type: "success" });
                  })
                  .finally(() => (disabled.value = false));
              } else {
                router.replace("welcome");
              }
            });
          } else {
            message(res?.message || "登录失败", { type: "error" });
@@ -224,16 +237,16 @@
      <img width="400px" :src="logo1" class="logo1" />
    </div>
    <!-- <img :src="bg" class="wave" /> -->
    <div class="flex-c absolute right-5 top-3">
      <!-- 主题 -->
      <el-switch
    <!-- <div class="flex-c absolute right-5 top-3"> -->
    <!-- 主题 -->
    <!-- <el-switch
        v-model="dataTheme"
        inline-prompt
        :active-icon="dayIcon"
        :inactive-icon="darkIcon"
        @change="dataThemeChange"
      />
    </div>
    </div> -->
    <div class="login-container">
      <div class="img">
        <!-- <component :is="toRaw(illustration)" /> -->
@@ -242,7 +255,7 @@
        <div class="login-form">
          <!-- <avatar class="avatar" /> -->
          <Motion>
            <h2 class="outline-hidden">{{ title }}</h2>
            <h2 class="logintitle">{{ state.nowRole.name }}登录</h2>
          </Motion>
          <el-form
@@ -251,7 +264,7 @@
            :rules="loginRules"
            size="large"
          >
            <Motion :delay="150">
            <!-- <Motion :delay="150">
              <el-form-item prop="exRoleCode">
                <el-radio-group v-model="state.ruleForm.exRoleCode">
                  <el-radio
@@ -262,7 +275,7 @@
                  >
                </el-radio-group>
              </el-form-item>
            </Motion>
            </Motion> -->
            <Motion :delay="100">
              <el-form-item
                :rules="[
@@ -382,4 +395,44 @@
#suffix-span {
  cursor: pointer;
}
.login-content-code {
  display: flex;
  align-items: center;
  justify-content: space-around;
  position: relative;
  .login-content-code-img {
    width: 100%;
    height: 40px;
    line-height: 40px;
    background-color: #ffffff;
    // /* border: 1px solid rgb(220, 223, 230); */
    cursor: pointer;
    transition: all ease 0.2s;
    border-radius: 4px;
    user-select: none;
    &:hover {
      border-color: #c0c4cc;
      transition: all ease 0.2s;
    }
  }
}
.login-content-code-expired {
  @extend .login-content-code;
  &::before {
    content: "验证码已过期";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    text-align: center;
    line-height: 40px;
  }
}
</style>