dcc
2024-07-02 431506e6b44e636f1e1df9ad6cde133b26b9800d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<template>
  <pc-section class="bg-white">
    <!-- 1.路由 -->
    <navigator></navigator>
    <!-- 2.内容 -->
    <div class="flex">
      <!-- 2.1左边 -->
      <section class="left">
        <!-- 菜单 -->
        <el-collapse
          v-if="needMenu"
          v-model="getActiveMenuName"
          @change="handleChange"
          class="collapse-wrapper mb-16"
        >
          <el-collapse-item
            class="item"
            :title="t(item.label)"
            :name="item.menu ? item.path : 'noexpand'"
            :class="[
              route.path == item.path ? 'active-item' : '',
              !item.menu || item.menu.length === 0 ? 'no-need-arrow' : '',
            ]"
            v-for="(item, index) in collapseList"
            :key="index"
            :disabled="!item.menu"
            @click="gotoPage(item.path)"
          >
            <!-- 二级菜单    -->
            <div v-if="item.menu && item.menu.length" class="second-wrap">
              <div
                class="second-item"
                :class="route.path === m.path ? 'second-active' : ''"
                v-for="(m, i) in item.menu"
                :key="i"
                @click="gotoPage(m.path, $event, true)"
              >
                {{ t(m.label) }}
              </div>
            </div>
          </el-collapse-item>
        </el-collapse>
        <!-- 准备好了吗 -->
        <div class="ready">
          <p class="mb-4">{{ t("ready-t1") }}</p>
          <h5 class="mb-4">{{ t("ready-d1") }}</h5>
          <el-button class="blue-large-btn" @click="handleTrade(scope.row)">
            {{ t("ready-b1") }}
          </el-button>
        </div>
      </section>
      <!-- 2.2右边 -->
      <section class="right">
        <slot name="content"></slot>
      </section>
    </div>
  </pc-section>
</template>
 
<script setup>
import { useRoute, useRouter } from "vue-router";
import { useI18n } from "vue-i18n";
import navigator from "./navigator.vue";
import router from "@/router";
 
const route = useRoute();
const { t } = useI18n();
const props = defineProps({
  collapseList: {
    type: Array,
    default: [],
  },
  needMenu: {
    type: Boolean,
    default: true,
  },
});
 
const getActiveMenuName = computed(() => {
  let name = route.path;
  const arr = route.path.split("/");
  const len = arr.length;
  if (len > 3) {
    // 为二级组件
    arr.splice(-1);
    name = arr.join("/");
  }
  return [name];
});
const gotoPage = (path, e, prevent) => {
  if (prevent) {
    e.stopPropagation();
  }
  router.push(path);
};
 
// 路由切换
const handleChange = (val) => {
  // val是个数组
};
</script>
 
<style lang="scss" scoped>
.left {
  margin-right: 52px;
  .el-collapse {
    border-top: none;
  }
}
// icon不展示
.no-need-arrow :deep(.el-collapse-item__arrow) {
  display: none;
}
 
// 一级menu
.item :deep(.el-collapse-item__header) {
  color: #000 !important;
  cursor: pointer !important;
}
.active-item :deep(.el-collapse-item__header) {
  color: #233ad4 !important;
}
// 二级menu
.second-wrap {
  background: #f6f6f6;
  padding-left: 20px;
  padding-top: 20px;
  .second-item {
    height: 50px;
    cursor: pointer;
  }
 
  .second-item:hover {
    color: #233ad4;
  }
 
  .second-active {
    color: #233ad4;
  }
}
.ready {
  border: 1px solid #d8dee1;
  padding: 24px;
  width: 352px;
  p {
    font-size: 32px;
    font-weight: 600;
  }
}
.right {
  width: 100%;
}
</style>