zhangwei
2025-08-05 445c059cc3c0ce36269b84cd52298af378837913
src/views/home/index.vue
@@ -1,24 +1,6 @@
el
<template>
  <div class="header">
    <img width="227px" height="74px" src="@/assets/home/logo.png" alt="" />
    <img width="427px" height="74px" src="@/assets/home/Header.png" alt="" />
    <div class="other">
      <div class="item">
        <img width="21px" height="21px" src="@/assets/home/share.png" alt="" />
        <span>分享网站</span>
      </div>
      <div class="item">
        <img
          width="21px"
          height="21px"
          src="@/assets/home/BellFilled.png"
          alt=""
        />
        <span>我的消息</span>
      </div>
    </div>
  </div>
  <my-header />
  <div class="banner">
    <!-- <img width="100%" height="306px" src="@/assets/home/banner.png" alt="" /> -->
  </div>
@@ -177,9 +159,9 @@
              v-else
              :underline="false"
              class="hover:cursor-pointer"
              @click="toApply"
              >申请</el-link
            ><span class="m-2">|</span>
              @click="toApply(item)"
              ><span v-if="item.name !== '评审专家'">申请</span></el-link
            ><span v-if="item.name !== '评审专家'" class="m-2">|</span>
            <el-link
              v-if="state.rolesCode.indexOf(item.code) !== -1"
              :underline="false"
@@ -394,17 +376,23 @@
<script lang="ts" setup>
import { onMounted, ref, computed, reactive } from "vue";
import myFooter from "./component/myFooter.vue";
import MyFooter from "./component/myFooter.vue";
import MyHeader from "./component/myHeader.vue";
import { useUserStoreHook } from "@/store/modules/user";
import { exRole } from "@/api/register/index.ts";
import { exRole } from "@/api/register/index";
import { storageLocal, isString, isIncludeAllChildren } from "@pureadmin/utils";
import { getToken } from "@/utils/auth";
import { useRoute, useRouter } from "vue-router";
const router = useRouter();
import { useUserStore } from "@/store/modules/user";
const userStore = useUserStore();
// 访问 state 属性
// console.log(userStore.roles,'-'); // 直接获取值
defineOptions({
  name: "Main"
  name: "MainPage"
});
let activeName = ref("first");
/** 角色(如果昵称为空则显示用户名) */
@@ -421,9 +409,10 @@
  accessToken: ""
});
onMounted(() => {
  exRole().then(res => {
    state.roleList = res.result;
  });
  // exRole().then(res => {
  //   state.roleList = res.result;
  // });
  state.roleList = useUserStoreHook().rolesList;
  getUseRoles();
  state.accessToken = getToken()?.accessToken;
});
@@ -434,19 +423,21 @@
// 退出
const logOut = () => {
  useUserStoreHook().logOut();
  state.rolesCode = [];
  state.accessToken = "";
};
// 申请
const toApply = () => {};
const toApply = item => {
  router.push({ name: "RegisterNav", query: { code: item.code } });
};
// 去首页
const toWelcome = item => {
  let role = state.userInfo?.exRoles.find(ele => {
    return item.code == ele.code;
  });
  console.log(role);
  if (role.hasFlsh) {
    return router.push({ name: "Welcome" });
const toWelcome = async item => {
  if (useUserStoreHook().nowRole.code !== item.code) {
    await useUserStoreHook().changeLogoInExRule({
      ruleCode: item.code
    });
  }
  router.push({ name: "RegisterNav" });
  router.push({ name: "Mine" });
};
// 去登录
const toLogin = item => {
@@ -455,39 +446,6 @@
</script>
<style lang="scss" scoped>
.header {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  height: 80px;
  width: 100%;
  .middle {
    width: 50%;
    display: flex;
    justify-content: space-around;
    color: rgb(51, 51, 51);
    font-family: 思源黑体;
  }
  .other {
    display: flex;
    .item {
      display: flex;
      justify-content: center;
      width: 63px;
      height: 48px;
      color: rgb(51, 51, 51);
      font-family: 思源黑体;
      font-size: 12px;
      font-weight: 400;
      line-height: 20px;
      letter-spacing: 0%;
      text-align: left;
      text-transform: capitalize;
      flex-wrap: wrap;
      margin-right: 10px;
    }
  }
}
.banner {
  //   left: -3.76px;
  //   top: 80px;
@@ -773,4 +731,8 @@
a:active {
  color: #fff;
}
.el-link.is-disabled {
  color: #a8abb2;
  cursor: not-allowed;
}
</style>