123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- <template>
- <div class="index">
- <el-row>
- <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
- <div class="left">
- <div class="left_1" @click="toHome">
- <el-image class="image" v-if="configInfo && configInfo.logoUrl && configInfo.logoUrl.length > 0" :src="getUrl(configInfo.logoUrl)" fit="fill" />
- <el-image class="image" v-else :src="siteInfo.logoUrl" fit="fill" />
- <div class="left_title">{{ configInfo.zhTitle || siteInfo.zhTitle }}</div>
- </div>
- <div class="left_2">
- <div class="menus" :class="[item.route_name == acitveKey ? 'menuTrue' : '']" v-for="item in menuList3" :key="item.id" @click="toActive(item)">
- <component class="icon" :is="item.icon"></component>
- <span class="name">{{ item.name }}</span>
- </div>
- </div>
- </div>
- <div class="right">
- <div class="right_1">
- <div class="name">{{ user.nick_name || '暂无昵称' }}</div>
- <div class="layout" @click="toOut">
- <LoginOutlined />
- <span>退出</span>
- </div>
- </div>
- <div class="right_2">
- <router-view></router-view>
- </div>
- </div>
- </el-col>
- </el-row>
- </div>
- </template>
- <script setup>
- import { LoginOutlined } from '@ant-design/icons-vue'
- import { siteInfo, menuList3 } from '@/layout/site'
- // 接口
- import { DesignStore } from '@/store/api/platform/design'
- const designStore = DesignStore()
- import { UserStore } from '@/store/user'
- const userStore = UserStore()
- const user = computed(() => userStore.user)
- // 加载中
- const loading = ref(false)
- // 路由
- const router = useRouter()
- const route = useRoute()
- const acitveKey = ref(route.name)
- const $checkRes = inject('$checkRes')
- const configInfo = ref({})
- // 请求
- onMounted(async () => {
- await searchOther()
- })
- const searchOther = async () => {
- // 基础设置
- const result = await designStore.query({})
- if ($checkRes(result)) {
- configInfo.value = result.data[0] || {}
- }
- }
- const toActive = async (item) => {
- acitveKey.value = item.route_name
- router.push({ path: item.path })
- }
- // 退出登录
- const toOut = () => {
- userStore.logOut()
- router.push({ path: '/login', query: { status: '1' } })
- }
- // 返回首页
- const toHome = () => {
- router.push({ path: `/` })
- }
- const getUrl = (item) => {
- if (item && item.length > 0) return `${import.meta.env.VITE_APP_HOST}${item[0].uri}`
- }
- watch(
- route,
- (newVal) => {
- if (newVal && newVal.name) acitveKey.value = newVal.name
- },
- {
- immediate: true //初始化立即执行
- }
- )
- </script>
- <style scoped lang="scss">
- .main {
- display: flex;
- background: #f1f6f9;
- min-height: 100vh;
- .left {
- width: 20%;
- background: linear-gradient(180deg, #165aa0, #4942dd);
- height: 100%;
- border-top-right-radius: 40px;
- border-bottom-right-radius: 40px;
- overflow: hidden;
- .left_1 {
- cursor: default;
- padding-top: 20px;
- padding-left: 10px;
- padding-right: 10px;
- color: #ffffff;
- display: flex;
- flex-direction: column;
- align-items: center;
- .image {
- height: 60px;
- width: 220px;
- }
- .left_title {
- padding: 10px 0 0 0;
- font-size: $global-font-size-24;
- font-family: 'Comic Sans MS', cursive;
- }
- }
- .left_2 {
- padding-left: 15px;
- padding-top: 35px;
- .menus {
- font-size: $global-font-size-20;
- font-weight: 500;
- color: #fff;
- height: 67px;
- line-height: 67px;
- padding-left: 80px;
- border-bottom-left-radius: 33px;
- border-top-left-radius: 33px;
- position: relative;
- cursor: pointer;
- .icon {
- display: inline-block;
- width: 1em;
- height: 1em;
- overflow: hidden;
- vertical-align: -0.15em;
- outline: none;
- margin-right: 5px;
- }
- }
- .menuTrue {
- background: #f1f6f9;
- color: #3961aa;
- }
- .menuTrue:after {
- content: url(/images/center_1.png);
- position: absolute;
- right: 0;
- top: -43px;
- }
- }
- }
- .right {
- width: 80%;
- padding: 0 20px;
- .right_1 {
- display: flex;
- justify-content: flex-end;
- height: 80px;
- line-height: 80px;
- font-size: $global-font-size-20;
- .layout {
- padding: 0 10px 0 20px;
- color: #8a8b8c;
- cursor: pointer;
- span {
- margin: 0 0 0 5px;
- }
- }
- }
- .right_2 {
- width: 100%;
- min-height: 90vh;
- background: #fff;
- border-radius: 10px;
- padding: 20px;
- }
- }
- }
- </style>
|