index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <div class="index">
  3. <el-row>
  4. <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
  5. <div class="left">
  6. <div class="left_1">
  7. <el-image class="image" v-if="configInfo && configInfo.logoUrl && configInfo.logoUrl.length > 0" :src="getUrl(configInfo.logoUrl)" fit="fill" />
  8. <el-image class="image" v-else :src="siteInfo.logoUrl" fit="fill" />
  9. <div class="left_title">{{ configInfo.zhTitle || siteInfo.zhTitle }}</div>
  10. </div>
  11. <div class="left_2">
  12. <div class="menus" :class="[item.route_name == acitveKey ? 'menuTrue' : '']" v-for="item in menuList3" :key="item.id" @click="toActive(item)">
  13. <component class="icon" :is="item.icon"></component>
  14. <span class="name">{{ item.name }}</span>
  15. </div>
  16. </div>
  17. </div>
  18. <div class="right">
  19. <div class="right_1">
  20. <div class="name">{{ user.nick_name || '暂无昵称' }}</div>
  21. <div class="layout" @click="toOut">
  22. <LoginOutlined />
  23. <span>退出</span>
  24. </div>
  25. </div>
  26. <div class="right_2">
  27. <router-view></router-view>
  28. </div>
  29. </div>
  30. </el-col>
  31. </el-row>
  32. </div>
  33. </template>
  34. <script setup>
  35. import { LoginOutlined } from '@ant-design/icons-vue'
  36. import { siteInfo, menuList3 } from '@/layout/site'
  37. // 接口
  38. import { DesignStore } from '@/store/api/platform/design'
  39. const designStore = DesignStore()
  40. import { UserStore } from '@/store/user'
  41. const userStore = UserStore()
  42. const user = computed(() => userStore.user)
  43. // 加载中
  44. const loading = ref(false)
  45. // 路由
  46. const router = useRouter()
  47. const route = useRoute()
  48. const acitveKey = ref(route.name)
  49. const $checkRes = inject('$checkRes')
  50. const configInfo = ref({})
  51. // 请求
  52. onMounted(async () => {
  53. await searchOther()
  54. })
  55. const searchOther = async () => {
  56. // 基础设置
  57. const result = await designStore.query({})
  58. if ($checkRes(result)) {
  59. configInfo.value = result.data[0] || {}
  60. }
  61. }
  62. const toActive = async (item) => {
  63. acitveKey.value = item.route_name
  64. router.push({ path: item.path })
  65. }
  66. // 退出登录
  67. const toOut = () => {
  68. userStore.logOut()
  69. router.push({ path: '/login', query: { status: '1' } })
  70. }
  71. const getUrl = (item) => {
  72. if (item && item.length > 0) return `${import.meta.env.VITE_APP_HOST}${item[0].uri}`
  73. }
  74. </script>
  75. <style scoped lang="scss">
  76. .main {
  77. display: flex;
  78. background: #f1f6f9;
  79. min-height: 100vh;
  80. .left {
  81. width: 20%;
  82. background: linear-gradient(180deg, #165aa0, #4942dd);
  83. height: 100%;
  84. border-top-right-radius: 40px;
  85. border-bottom-right-radius: 40px;
  86. .left_1 {
  87. padding-top: 20px;
  88. padding-left: 10px;
  89. padding-right: 10px;
  90. color: #ffffff;
  91. display: flex;
  92. flex-direction: column;
  93. align-items: center;
  94. .image {
  95. height: 60px;
  96. width: 220px;
  97. }
  98. .left_title {
  99. padding: 10px 0 0 0;
  100. font-size: $global-font-size-24;
  101. font-family: 'Comic Sans MS', cursive;
  102. }
  103. }
  104. .left_2 {
  105. padding-left: 15px;
  106. padding-top: 25px;
  107. .menus {
  108. font-size: $global-font-size-20;
  109. font-weight: 500;
  110. color: #fff;
  111. height: 67px;
  112. line-height: 67px;
  113. padding-left: 80px;
  114. border-bottom-left-radius: 33px;
  115. border-top-left-radius: 33px;
  116. position: relative;
  117. cursor: pointer;
  118. .icon {
  119. display: inline-block;
  120. width: 1em;
  121. height: 1em;
  122. overflow: hidden;
  123. vertical-align: -0.15em;
  124. outline: none;
  125. margin-right: 5px;
  126. }
  127. }
  128. .menuTrue {
  129. background: #f1f6f9;
  130. color: #3961aa;
  131. }
  132. .menuTrue:after {
  133. content: url(/images/center_1.png);
  134. position: absolute;
  135. right: 0;
  136. top: -43px;
  137. }
  138. }
  139. }
  140. .right {
  141. width: 80%;
  142. padding: 0 20px;
  143. .right_1 {
  144. display: flex;
  145. justify-content: flex-end;
  146. height: 80px;
  147. line-height: 80px;
  148. font-size: $global-font-size-20;
  149. .layout {
  150. padding: 0 10px 0 20px;
  151. color: #8a8b8c;
  152. cursor: pointer;
  153. span {
  154. margin: 0 0 0 5px;
  155. }
  156. }
  157. }
  158. .right_2 {
  159. width: 100%;
  160. min-height: 90vh;
  161. background: #fff;
  162. border-radius: 10px;
  163. padding: 20px;
  164. }
  165. }
  166. }
  167. </style>