App.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <div class="body-box" v-if="isShowHeader">
  3. <SidevarItem></SidevarItem>
  4. <div class="content">
  5. <Navbar></Navbar>
  6. <!-- <router-view></router-view> -->
  7. <router-view v-slot="{ Component, route }">
  8. <transition name="animation" mode="out-in">
  9. <component :is="Component" :key="route.path" />
  10. </transition>
  11. </router-view>
  12. </div>
  13. </div>
  14. <div class="body-box" v-else>
  15. <router-view></router-view>
  16. </div>
  17. </template>
  18. <script setup>
  19. import { ref, reactive, onBeforeMount, onMounted, watch } from "vue";
  20. import Navbar from "@/layout/Navbar.vue";
  21. import SidevarItem from "@/layout/SidevarItem.vue";
  22. import { useRouter } from "vue-router";
  23. import { storeToRefs } from "pinia";
  24. import { useCounterStore } from "@/stores/index";
  25. const store = useCounterStore();
  26. const router = useRouter();
  27. const isShowHeader = ref(true);
  28. // 监听路由判断是否显示导航条
  29. watch(
  30. () => router.currentRoute.value,
  31. (newValue) => {
  32. // console.log(newValue);
  33. store.SETMENU(newValue.fullPath);
  34. isShowHeader.value = newValue.meta.showHeader;
  35. },
  36. { immediate: true, deep: true },
  37. );
  38. const tableData = reactive({
  39. list: [],
  40. });
  41. onBeforeMount(async () => {
  42. // console.log('App/onBeforeMount');
  43. });
  44. </script>
  45. <style lang="scss">
  46. #app {
  47. width: 100%;
  48. height: 100%;
  49. margin: 0;
  50. padding: 0;
  51. text-align: unset;
  52. overflow: auto;
  53. }
  54. .el-dialog {
  55. border-radius: 5px !important;
  56. padding: 0 !important;
  57. .el-dialog__header {
  58. border-radius: 5px 5px 0 0;
  59. background: rgba(237, 241, 245, 1);
  60. font-weight: 600;
  61. height: 56px;
  62. margin: 0;
  63. padding: 0 0 0 20px;
  64. display: flex;
  65. align-items: center;
  66. .el-dialog__headerbtn {
  67. outline: none;
  68. top: 4px;
  69. }
  70. }
  71. .el-dialog__body {
  72. padding: 20px 20px 0 20px;
  73. .el-input {
  74. width: 400px;
  75. }
  76. .el-textarea {
  77. width: 400px;
  78. }
  79. .el-select {
  80. width: 400px;
  81. }
  82. .options {
  83. display: flex;
  84. flex-direction: row-reverse;
  85. .el-form-item__content {
  86. margin-left: 0 !important;
  87. flex: none;
  88. }
  89. }
  90. }
  91. }
  92. .is-message-box {
  93. .el-message-box__header {
  94. .el-message-box__headerbtn {
  95. outline: none;
  96. }
  97. }
  98. .el-message-box__btns {
  99. .el-button {
  100. outline: none;
  101. }
  102. .el-button--primary {
  103. background-color: rgba(61, 81, 232, 1);
  104. border: 0.5px solid rgba(61, 81, 232, 1);
  105. }
  106. .el-button--primary:hover {
  107. background-color: rgb(119, 133, 239);
  108. border: 0.5px solid rgb(119, 133, 239);
  109. }
  110. }
  111. }
  112. *::-webkit-scrollbar-track {
  113. background-color: #fff;
  114. }
  115. *::-webkit-scrollbar {
  116. background-color: #57b2ff;
  117. height: 0;
  118. width: 0;
  119. }
  120. *::-webkit-scrollbar-thumb {
  121. background: #57b2ff;
  122. border-radius: 4px;
  123. height: 0;
  124. width: 0;
  125. }
  126. // 进度条颜色
  127. #nprogress .bar {
  128. background-color: rgb(111, 182, 184) !important;
  129. }
  130. /* 自定义图片预览列表样式 */
  131. .img-preview-list {
  132. display: flex;
  133. flex-wrap: wrap;
  134. gap: 12px;
  135. :deep(.el-upload-list) {
  136. display: none;
  137. }
  138. // 上传图片样式
  139. .img-item {
  140. position: relative;
  141. width: 140px;
  142. height: 140px;
  143. border-radius: 4px;
  144. overflow: hidden;
  145. border: 1px solid #eee;
  146. .preview-img {
  147. width: 100%;
  148. height: 100%;
  149. object-fit: contain;
  150. cursor: zoom-in;
  151. }
  152. /* 删除按钮样式 */
  153. .delete-btn {
  154. position: absolute;
  155. top: 0;
  156. right: 0;
  157. background: rgba(0, 0, 0, 0.5);
  158. color: #fff;
  159. width: 24px;
  160. height: 24px;
  161. display: flex;
  162. align-items: center;
  163. justify-content: center;
  164. cursor: pointer;
  165. opacity: 0;
  166. transition: opacity 0.3s;
  167. }
  168. &:hover .delete-btn {
  169. opacity: 1;
  170. }
  171. }
  172. .upload-btn {
  173. display: flex;
  174. justify-content: center;
  175. align-items: center;
  176. // padding: 8px 16px;
  177. border: 1px dashed #d9d9d9;
  178. border-radius: 4px;
  179. cursor: pointer;
  180. color: #666;
  181. transition: all 0.3s;
  182. width: 140px;
  183. height: 140px;
  184. &:hover {
  185. border-color: #409eff;
  186. color: #409eff;
  187. }
  188. .upload-txt {
  189. font-size: 14px;
  190. }
  191. .el-upload {
  192. width: 140px;
  193. height: 140px;
  194. display: flex;
  195. justify-content: center;
  196. align-items: center;
  197. }
  198. .el-upload-list {
  199. display: none;
  200. }
  201. }
  202. }
  203. .viewer-container, /* v-viewer 根容器 */
  204. .el-image-viewer__wrapper, /* Element 预览层 */
  205. .photo-preview-modal /* vue-photo-preview 根容器 */
  206. {
  207. z-index: 9999 !important; /* 远高于所有弹窗/表格 */
  208. position: fixed !important; /* 脱离文档流,不继承父层级 */
  209. top: 0 !important;
  210. left: 0 !important;
  211. right: 0 !important;
  212. bottom: 0 !important;
  213. }
  214. </style>
  215. <style scoped lang="scss">
  216. .body-box {
  217. display: flex;
  218. width: 100%;
  219. .content {
  220. min-width: calc(100% - 200px);
  221. max-width: calc(100% - 63px);
  222. width: 100%;
  223. height: 100vh;
  224. background-color: rgba(238, 238, 238, 1);
  225. :deep(.el-dialog__header .el-dialog__headerbtn) {
  226. outline: none;
  227. }
  228. }
  229. }
  230. /* 过度动画配置代码 */
  231. .animation-enter-from,
  232. .animation-leave-to {
  233. transform: translateX(20px);
  234. opacity: 0;
  235. }
  236. .animation-enter-to,
  237. .animation-leave-from {
  238. opacity: 1;
  239. }
  240. .animation-enter-active {
  241. transition: all 0.7s ease;
  242. }
  243. .animation-leave-active {
  244. transition: all 0.3s cubic-bezier(1, 0.6, 0.6, 1);
  245. }
  246. </style>