index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <div class="page">
  3. <div class="gva-card-box">
  4. <div class="gva-card gva-top-card">
  5. <div class="gva-top-card-left">
  6. <div class="gva-top-card-left-title">早安,管理员,请开始一天的工作吧</div>
  7. <div class="gva-top-card-left-dot">{{ weatherInfo }}</div>
  8. <el-row class="my-8 w-[500px]">
  9. <el-col
  10. :span="8"
  11. :xs="24"
  12. :sm="8"
  13. >
  14. <div class="flex items-center">
  15. <el-icon class="dashboard-icon">
  16. <sort />
  17. </el-icon>
  18. 今日流量 (1231231)
  19. </div>
  20. </el-col>
  21. <el-col
  22. :span="8"
  23. :xs="24"
  24. :sm="8"
  25. >
  26. <div class="flex items-center">
  27. <el-icon class="dashboard-icon">
  28. <avatar />
  29. </el-icon>
  30. 总用户数 (24001)
  31. </div>
  32. </el-col>
  33. <el-col
  34. :span="8"
  35. :xs="24"
  36. :sm="8"
  37. >
  38. <div class="flex items-center">
  39. <el-icon class="dashboard-icon">
  40. <comment />
  41. </el-icon>
  42. 好评率 (99%)
  43. </div>
  44. </el-col>
  45. </el-row>
  46. </div>
  47. <img
  48. src="@/assets/dashboard.png"
  49. class="gva-top-card-right"
  50. alt
  51. >
  52. </div>
  53. </div>
  54. <div class="gva-card-box">
  55. <div class="gva-card quick-entrance">
  56. <div class="gva-card-title">快捷入口</div>
  57. <el-row :gutter="20">
  58. <el-col
  59. v-for="(card, key) in toolCards"
  60. :key="key"
  61. :span="4"
  62. :xs="8"
  63. class="quick-entrance-items"
  64. @click="toTarget(card.name)"
  65. >
  66. <div class="quick-entrance-item">
  67. <div
  68. class="quick-entrance-item-icon"
  69. :style="{ backgroundColor: card.bg }"
  70. >
  71. <el-icon>
  72. <component
  73. :is="card.icon"
  74. :style="{ color: card.color }"
  75. />
  76. </el-icon>
  77. </div>
  78. <p>{{ card.label }}</p>
  79. </div>
  80. </el-col>
  81. </el-row>
  82. </div>
  83. </div>
  84. <div class="gva-card-box">
  85. <div class="gva-card">
  86. <div class="gva-card-title">数据统计</div>
  87. <div class="p-4">
  88. <el-row :gutter="20">
  89. <el-col
  90. :xs="24"
  91. :sm="18"
  92. >
  93. <echarts-line />
  94. </el-col>
  95. <el-col
  96. :xs="24"
  97. :sm="6"
  98. >
  99. <dashboard-table />
  100. </el-col>
  101. </el-row>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. </template>
  107. <script setup>
  108. import EchartsLine from '@/view/dashboard/dashboardCharts/echartsLine.vue'
  109. import DashboardTable from '@/view/dashboard/dashboardTable/dashboardTable.vue'
  110. import { ref } from 'vue'
  111. import { useRouter } from 'vue-router'
  112. import { useWeatherInfo } from '@/view/dashboard/weather.js'
  113. defineOptions({
  114. name: 'Dashboard'
  115. })
  116. const weatherInfo = useWeatherInfo()
  117. const toolCards = ref([
  118. {
  119. label: '用户管理',
  120. icon: 'monitor',
  121. name: 'user',
  122. color: '#ff9c6e',
  123. bg: 'rgba(255, 156, 110,.3)'
  124. },
  125. {
  126. label: '角色管理',
  127. icon: 'setting',
  128. name: 'authority',
  129. color: '#69c0ff',
  130. bg: 'rgba(105, 192, 255,.3)'
  131. },
  132. {
  133. label: '菜单管理',
  134. icon: 'menu',
  135. name: 'menu',
  136. color: '#b37feb',
  137. bg: 'rgba(179, 127, 235,.3)'
  138. },
  139. {
  140. label: '代码生成器',
  141. icon: 'cpu',
  142. name: 'autoCode',
  143. color: '#ffd666',
  144. bg: 'rgba(255, 214, 102,.3)'
  145. },
  146. {
  147. label: '表单生成器',
  148. icon: 'document-checked',
  149. name: 'formCreate',
  150. color: '#ff85c0',
  151. bg: 'rgba(255, 133, 192,.3)'
  152. },
  153. {
  154. label: '关于我们',
  155. icon: 'user',
  156. name: 'about',
  157. color: '#5cdbd3',
  158. bg: 'rgba(92, 219, 211,.3)'
  159. }
  160. ])
  161. const router = useRouter()
  162. const toTarget = (name) => {
  163. router.push({ name })
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. .page {
  168. @apply p-0;
  169. .gva-card-box{
  170. @apply p-4;
  171. &+.gva-card-box{
  172. @apply pt-0;
  173. }
  174. }
  175. .gva-card {
  176. @apply box-border bg-white rounded h-auto px-6 py-8 overflow-hidden shadow-sm;
  177. .gva-card-title{
  178. @apply pb-5 border-t-0 border-l-0 border-r-0 border-b border-solid border-gray-100;
  179. }
  180. }
  181. .gva-top-card {
  182. @apply h-72 flex items-center justify-between text-gray-500;
  183. &-left {
  184. @apply h-full flex flex-col w-auto;
  185. &-title {
  186. @apply text-3xl text-gray-600;
  187. }
  188. &-dot {
  189. @apply mt-4 text-gray-600 text-lg;
  190. }
  191. &-item{
  192. +.gva-top-card-left-item{
  193. margin-top: 24px;
  194. }
  195. margin-top: 14px;
  196. }
  197. }
  198. &-right {
  199. height: 600px;
  200. width: 600px;
  201. margin-top: 28px;
  202. }
  203. }
  204. ::v-deep(.el-card__header){
  205. @apply p-0 border-gray-200;
  206. }
  207. .card-header{
  208. @apply pb-5 border-b border-solid border-gray-200 border-t-0 border-l-0 border-r-0;
  209. }
  210. .quick-entrance-items {
  211. @apply flex items-center justify-center text-center text-gray-800;
  212. .quick-entrance-item {
  213. @apply px-8 py-6 flex items-center flex-col transition-all duration-100 ease-in-out rounded-lg cursor-pointer;
  214. &:hover{
  215. @apply shadow-lg;
  216. }
  217. &-icon {
  218. @apply flex items-center h-16 w-16 rounded-lg justify-center mx-0 my-auto text-2xl;
  219. }
  220. p {
  221. @apply mt-2.5;
  222. }
  223. }
  224. }
  225. }
  226. .dashboard-icon {
  227. @apply flex items-center text-xl mr-2 text-blue-400;
  228. }
  229. </style>