users.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <div class="user-wrapper wrapper_1200">
  3. <div class="content acea-row relative mt-20px">
  4. <!--左侧菜单-->
  5. <div class="left-box">
  6. <div class="user-menu">
  7. <el-collapse v-model="opened">
  8. <el-collapse-item
  9. v-for="item in userMenu"
  10. :key="item.id"
  11. :title="item.name"
  12. :name="item.name"
  13. class="fonts16 fontColor333 font-500 oppoSans-M user-name"
  14. >
  15. <div
  16. @click="handleGoPage(items)"
  17. v-for="items in item.child"
  18. :key="items.id"
  19. class="menu-item child fonts14 mbtom24 fontColor6 font-400 oppoSans-R"
  20. :class="{ active: menuCur == items.id }"
  21. >
  22. {{ items.name }}
  23. </div>
  24. </el-collapse-item>
  25. </el-collapse>
  26. </div>
  27. </div>
  28. <!--右侧页面-->
  29. <div class="right-box" :style="{ minHeight: ScrollHeight + 'px' }">
  30. <!--登录之后显示页面,协议不需要登录-->
  31. <div v-if="userStore.isLogin || (!userStore.isLogin&&route.path.includes('agreement_rules'))" class="right-centent">
  32. <NuxtPage></NuxtPage>
  33. </div>
  34. <!--没登录显示页面-->
  35. <div v-else class="w-100% h-100%">
  36. <not-logged-in></not-logged-in>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. </template>
  42. <script setup lang="ts">
  43. import { ref, reactive, watch,computed } from 'vue'
  44. import { userMenuDefault } from '~/pages/users/defaultUser'
  45. import { useUserStore } from '@/stores/user'
  46. import NotLoggedIn from "~/components/notLoggedIn.vue";
  47. import {ItemObject} from "~/types/global";
  48. const userStore = useUserStore()
  49. //获取浏览器值
  50. const route = useRoute()
  51. //窗口的高度
  52. const { getWindowHeight } = useScrollHeight()
  53. const ScrollHeight = ref<number>(getWindowHeight() - 215)
  54. //菜单
  55. const userMenu = reactive<any[]>(userMenuDefault())
  56. //左侧菜单选中的值
  57. const menuCur = ref<string>(<string>route.query.type)
  58. watch(
  59. () => <string>route.query.type,
  60. (newValue) => {
  61. menuCur.value = newValue
  62. },
  63. )
  64. //菜单除协议其余默认全部展开
  65. const opened = computed(()=>{
  66. return userMenu.map((i:ItemObject)=>{
  67. if(i.name !=='规则协议') return i.name
  68. })
  69. })
  70. // 跳入页面
  71. const handleGoPage = async (obj: any) => {
  72. menuCur.value = obj.id
  73. await linkNavigateTo(obj.pc_url, { type: obj.id, name: obj.name })
  74. }
  75. </script>
  76. <style lang="scss" scoped>
  77. :deep(.el-collapse),
  78. :deep(.el-collapse-item__wrap) {
  79. border: none !important;
  80. }
  81. :deep(.el-collapse-item__header) {
  82. --el-collapse-header-height: auto !important;
  83. border: none !important;
  84. --el-collapse-header-font-size: 16px;
  85. margin-bottom: 24px;
  86. }
  87. :deep(.el-collapse-item__content) {
  88. padding-bottom: 0 !important;
  89. }
  90. .user-wrapper {
  91. .left-box {
  92. width: 180px;
  93. .user-info {
  94. display: flex;
  95. flex-direction: column;
  96. align-items: center;
  97. justify-content: center;
  98. height: 170px;
  99. background: #fff;
  100. color: #282828;
  101. .name {
  102. margin-top: 10px;
  103. padding: 0 15px;
  104. }
  105. }
  106. .user-menu {
  107. padding: 30px 30px 21px 45px;
  108. border-radius: 16px 16px 16px 16px;
  109. background: #fff;
  110. overflow: scroll;
  111. scrollbar-width: none; /* Firefox */
  112. -ms-overflow-style: none; /* IE and Edge */
  113. .user-name{
  114. margin-bottom: 24px;
  115. &:last-of-type {
  116. margin-bottom: 0px;
  117. }
  118. }
  119. &::-webkit-scrollbar {
  120. height: 0;
  121. width: 0;
  122. display: none; /* Chrome, Safari, and Opera */
  123. }
  124. .child:last-of-type {
  125. margin-bottom: 10px;
  126. }
  127. .menu-item {
  128. display: block;
  129. cursor: pointer;
  130. &.active {
  131. color: #e93323;
  132. }
  133. }
  134. }
  135. }
  136. .right-centent {
  137. background: #ffffff;
  138. border-radius: 16px 16px 16px 16px;
  139. width: 1000px;
  140. margin-left: 20px;
  141. padding: 30px 20px;
  142. }
  143. }
  144. .router-tips {
  145. height: 40px;
  146. line-height: 40px;
  147. font-size: 14px;
  148. color: #333;
  149. a {
  150. color: #333;
  151. }
  152. span {
  153. color: #999999;
  154. }
  155. }
  156. </style>