You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.2 KiB

4 months ago
5 months ago
5 months ago
5 months ago
7 months ago
7 months ago
5 months ago
4 months ago
4 months ago
  1. <template>
  2. <!-- 头部 -->
  3. <el-header class="header">
  4. <div class="title">数据总览</div>
  5. </el-header>
  6. <div style="height: 100vh;">
  7. <el-row class="cards">
  8. <el-col :span="14">
  9. <GoldManagement/>
  10. </el-col>
  11. <!-- 右上格子占12列 -->
  12. <el-col :span="10">
  13. <CashManagement/>
  14. </el-col>
  15. </el-row>
  16. <el-row class="graphs">
  17. <el-col :span="24">
  18. <div v-if="loading">加载中...</div>
  19. <GoldGraphMarkets v-else-if="GraphFlag" />
  20. <GoldGraph v-else />
  21. </el-col>
  22. </el-row>
  23. </div>
  24. </template>
  25. <script setup>
  26. import GoldManagement from "@/components/workspace/GoldManagement.vue"
  27. import CashManagement from "@/components/workspace/CashManagement.vue"
  28. import GoldGraphMarkets from "@/components/workspace/GoldGraphMarkets.vue";
  29. import API from "@/util/http.js";
  30. import {onMounted, ref} from "vue";
  31. import GoldGraph from "@/components/workspace/GoldGraph.vue";
  32. const GraphFlag = ref();
  33. const loading = ref(true); // 新增加载状态
  34. const getAdminData = async function () {
  35. try {
  36. loading.value = true; // 开始加载
  37. const result = await API({url: '/admin/userinfo', data: {}});
  38. GraphFlag.value = result.markets !== '总部' && result.markets !== '研发部' && result.markets !== 'headquarters'
  39. ;
  40. console.log("GraphFlag",GraphFlag.value);
  41. } catch (error) {
  42. console.log('请求失败', error);
  43. } finally {
  44. loading.value = false; // 无论成功失败都结束加载
  45. }
  46. };
  47. onMounted(async () => {
  48. await getAdminData()
  49. })
  50. </script>
  51. <style scoped>
  52. .header {
  53. /* 将纯色背景替换为线性渐变 */
  54. background: linear-gradient(
  55. 90deg,
  56. rgba(228, 240, 252, 1) 20%,
  57. rgba(190, 218, 247, 1) 50%,
  58. rgba(228, 240, 252, 1) 100%
  59. );
  60. height: 6vh;
  61. border-radius: 12px;
  62. margin-bottom: 4px;
  63. box-shadow: 0 2px 5px rgba(8, 4, 4, 0.1);
  64. /* 添加阴影增强层次感 */
  65. z-index: 80;
  66. display: flex;
  67. align-items: center;
  68. justify-content: center;
  69. }
  70. .title {
  71. width: 136px;
  72. color: #040a2d;
  73. font-family: "PingFang SC";
  74. font-size: 34px;
  75. font-style: normal;
  76. font-weight: 900;
  77. line-height: 31.79px;
  78. text-align: center;
  79. }
  80. .graphs {
  81. padding-bottom: 10px;
  82. }
  83. </style>