[...all].vue 7.31 KB
<route lang="yaml">
name: notFound
meta:
  title: 可信数据空间
  constant: true
  layout: false
</route>

<script lang="ts" setup>
import useUserStore from '@/store/modules/user';
import { USERROLE } from '@/utils/enum';
import { ElMessage } from 'element-plus';

const userStore = useUserStore()
const router = useRouter()
const route = useRoute()

/** 对话框显示隐藏 */
const dialogVisible = computed(() => {
  return route.query.code && userStore.isGetCurrUserInfo;
});

const loading = ref(false);

/** 记录用户选择的角色 */
const selectRole = ref(USERROLE.USE); //TODO,在专区需要默认值是平台运营方。

onBeforeRouteLeave(() => {
})

onMounted(() => {
  goBack()
})

function goBack() {
}

const beforeLogin = () => {
  loading.value = true;
  if (userStore.getTokenPromise) {
    userStore.getTokenPromise.then(() => {
      userStore.getUserSystemMenuByRole(selectRole.value).then((res) => {
        loading.value = false;
        if (res && res !== false) {
          if (res?.length === 0) {
            ElMessage.warning('该系统用户暂无可用的菜单,请先配置');
            return;
          }
          localStorage.setItem('userRole', selectRole.value);
          userStore.isGetCurrUserInfo = false;
          router.push('/')
        }
      })
    }).catch(() => {
      loading.value = false;
    });
  } else {
    userStore.getUserSystemMenuByRole(selectRole.value).then((res) => {
      loading.value = false;
      if (res && res !== false) {
        if (res?.length === 0) {
          ElMessage.warning('该系统用户暂无可用的菜单,请先配置');
          return;
        }
        localStorage.setItem('userRole', selectRole.value);
        userStore.isGetCurrUserInfo = false;
        router.push('/')
      }
    }).catch(() => {
      loading.value = false;
    });
  }
}

</script>

<template>
  <div class="full-page">
    <div class="notfound" v-show="!dialogVisible">
      <img style="width: 480px; height: 110px;" src="../../public/swzl_logo.gif">
    </div>
    <div class="bg-banner" v-if="dialogVisible">
      <div id="login-box">
        <div class="login_form login-size">
          <div class="login-title">选择角色</div>
          <div class="row-main">
            <div class="per" :class="selectRole == USERROLE.USE ? 'selected' : ''" @click="selectRole = USERROLE.USE">
              <div class="img-use"></div>
              <div class="title">数据使用方</div>
            </div>
            <div class="per" :class="selectRole == USERROLE.PROVIDER ? 'selected' : ''" @click="selectRole = USERROLE.PROVIDER">
              <div class="img-provider"></div>
              <div class="title">数据提供方</div>
            </div>
            <!-- 只有专区才有 -->
            <!-- <div class="per" :class="selectRole == USERROLE.OPERATION ? 'selected' : ''" @click="selectRole = USERROLE.OPERATION">
              <div class="img-operation"></div>
              <div class="title">平台运营方</div>
            </div> -->
          </div>
          <div class="login-footer">
            <el-button :loading="loading" ref="loginButton" type="primary" size="large" style="width: 100%;"
              @click.prevent="beforeLogin">确认</el-button>
          </div>
        </div>
      </div>
      <div class="copyright_text">
        <span>Copyright © 2015-2024</span>
        <a style="color: #4FA1A4;margin: 0 8px;" href="https://beian.miit.gov.cn" target="_blank">京ICP备2024044205号</a>
        <span>北京传世博润科技有限公司</span>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.full-page {
  height: 100%;
  width: 100%;
}

.notfound {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;

  @include position-center(xy);

  .icon {
    width: 400px;
    height: 400px;
  }

  .content {
    h1 {
      margin: 0;
      font-size: 72px;
      color: var(--el-text-color-primary);
    }

    .desc {
      margin: 20px 0 30px;
      font-size: 20px;
      color: var(--el-text-color-secondary);
    }
  }
}

.bg-banner {
  // position: fixed;
  // z-index: 1001;
  width: 100%;
  height: 100%;
  background-image: url('@/assets/images/login-bg.png');
  background-size: cover;
  /* 背景图覆盖整个元素 */
  background-position: center;
  /* 背景图居中 */
  background-repeat: no-repeat;
  /* 防止背景图重复 */
}

#login-box {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;

  .login-form {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 500px;
    width: 368px;
    overflow: hidden;

    .title-container {
      position: relative;

      .title {
        font-size: 28px;
        color: #212121;
        letter-spacing: 0;
        text-align: center;
        line-height: 42px;
        font-weight: 600;
        margin-bottom: 32px;
      }
    }
  }

}

.login-title {
  font-family: PingFangSC-Semibold;
  font-size: 24px;
  color: #212121;
  letter-spacing: 0;
  line-height: 36px;
  font-weight: 600;
  margin-bottom: 33px;
}

.login_form {
  position: relative;
  background: #FFFFFF;
  box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.2);
  border-radius: 2px;

  .row-main {
    display: flex;
    flex-direction: row;
    column-gap: 40px;

    .per {
      cursor: pointer;

      &.selected {
        .img-use {
          background-image: url('@/assets/images/dataUser-select.png');
        }

        .img-provider {
          background-image: url('@/assets/images/dataProvider-select.png');
        }

        .img-operation {
          background-image: url('@/assets/images/dataOperation-select.png');
        }

        .title {
          color: #1478E9;
        }
      }

      .img-use {
        width: 100px;
        height: 100px;
        background-image: url('@/assets/images/dataUser-default.png');
        background-size: cover;
        /* 背景图覆盖整个元素 */
        background-position: center;
        /* 背景图居中 */
        background-repeat: no-repeat;
      }

      .img-provider {
        width: 100px;
        height: 100px;
        background-image: url('@/assets/images/dataProvider-default.png');
        background-size: cover;
        /* 背景图覆盖整个元素 */
        background-position: center;
        /* 背景图居中 */
        background-repeat: no-repeat;
      }

      .img-operation {
        width: 100px;
        height: 100px;
        background-image: url('@/assets/images/dataOperation-default.png');
        background-size: cover;
        /* 背景图覆盖整个元素 */
        background-position: center;
        /* 背景图居中 */
        background-repeat: no-repeat;
      }

      .title {
        margin-top: 8px;
        font-family: PingFangSC-Regular;
        font-size: 14px;
        color: #666666;
        line-height: 21px;
        font-weight: 400;
        text-align: center;
      }
    }
  }
}

.login-size {
  padding: 40px 32px;
  width: 444px;
  height: 420px;
}

.login-footer {
  display: flex;
  flex-direction: column;
  margin-top: 54px;
}

:deep(.el-button--primary) {
  background-image: linear-gradient(116deg, #0C48F5 0%, #23D6D1 95%);
}

.copyright_text {
  width: 100%;
  font-size: 12px;
  color: #2c3e50;
  line-height: 18px;
  text-align: center;
  font-weight: 400;
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
}
</style>