App.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. <template>
  2. <router-view v-slot="{ Component }">
  3. <keep-alive>
  4. <component :is="Component"/>
  5. </keep-alive>
  6. </router-view>
  7. </template>
  8. <script>
  9. import {defineComponent} from 'vue'
  10. import locale from 'element-plus/lib/locale/lang/zh-cn'
  11. import {useStore} from 'vuex'
  12. import store from "@/store";
  13. import {setCallback} from "@/utils/websocket";
  14. import {ElMessageBox, ElNotification} from "element-plus";
  15. import sleep from "@/utils/sleep";
  16. export default defineComponent({
  17. name: 'App',
  18. setup() {
  19. const store = useStore()
  20. let windowSize = getWindowSize()
  21. store.commit('app/setWindowSize', windowSize)
  22. store.commit('app/setJdt', {
  23. title: '数据上传',
  24. isOpen: false,
  25. abnormalClosing: false,
  26. })
  27. window.onresize = () => {
  28. store.commit('app/setWindowSize', getWindowSize())
  29. }
  30. onMounted(() => {
  31. setCallback('refreshToken', (data) => {
  32. store.commit('user/tokenChange', data.token)
  33. })
  34. setCallback('sidSingle', async () => {
  35. await store.dispatch('user/loginOut')
  36. await ElMessageBox.alert('您的账号已在其他地方登陆,如需修改密码请在个人中心中修改。', '提示', {
  37. type: 'warning',
  38. })
  39. })
  40. setCallback('systemNotification', async (data) => {
  41. if (data.count) {
  42. let newCount = store.state.app.unreadMessageCount + data.count
  43. store.commit('app/setUnreadMessageCount', newCount)
  44. }
  45. if (data.refreshDelay) {
  46. sleep(data.refreshDelay).then(() => {
  47. location.reload();
  48. })
  49. }
  50. ElNotification({
  51. title: typeof data.title === 'undefined' ? '新消息' : data.title,
  52. message: data.message,
  53. dangerouslyUseHTMLString: true,
  54. type: typeof data.type === 'undefined' ? 'warning' : data.type,
  55. duration: 0,
  56. })
  57. })
  58. })
  59. return {
  60. locale,
  61. }
  62. },
  63. })
  64. function getWindowSize() {
  65. const w = window.innerWidth
  66. const h = window.innerHeight - 96
  67. return {w, h}
  68. }
  69. </script>
  70. <style lang="scss">
  71. html,
  72. body,
  73. #app {
  74. height: 100%;
  75. margin: 0;
  76. padding: 0;
  77. }
  78. ul, li {
  79. list-style: none;
  80. margin: 0;
  81. padding: 0;
  82. }
  83. .小手指 {
  84. cursor: pointer;
  85. }
  86. .xc_box {
  87. box-shadow: 0 4px 8px rgb(0 0 0 / 20%), 0 6px 20px rgb(0 0 0 / 19%);
  88. }
  89. #app {
  90. font-family: Avenir, Helvetica, Arial, sans-serif;
  91. -webkit-font-smoothing: antialiased;
  92. -moz-osx-font-smoothing: grayscale;
  93. color: #2c3e50;
  94. width: 100%;
  95. height: 100vh;
  96. font-size: 13px;
  97. }
  98. .ellipsis-text {
  99. text-overflow: ellipsis;
  100. white-space: nowrap;
  101. overflow: hidden;
  102. }
  103. .sex-icon {
  104. width: 15px;
  105. height: 15px;
  106. }
  107. .el-table .cell {
  108. padding-left: 4px;
  109. padding-right: 4px;
  110. }
  111. .el-header {
  112. padding: 0 14px;
  113. height: 36px;
  114. display: flex;
  115. align-items: center;
  116. justify-content: flex-start;
  117. }
  118. .el-header > * {
  119. flex-wrap: nowrap;
  120. flex-shrink: 0;
  121. flex-grow: 0;
  122. }
  123. .el-main {
  124. padding: 0 14px;
  125. }
  126. .el-table__body tr.current-row > td,
  127. .el-table--striped .el-table__body tr.el-table__row--striped.current-row td {
  128. background-color: #a7d3ff !important;
  129. }
  130. .el-input.is-disabled .el-input__inner {
  131. color: blue;
  132. }
  133. .icon-shangxiatuodong {
  134. cursor: move;
  135. font-size: 12px;
  136. }
  137. .shangxiatuodong {
  138. cursor: move;
  139. }
  140. .el-checkbox__inner {
  141. width: 16px;
  142. height: 16px;
  143. border: 1px solid #000;
  144. border-radius: 4px;
  145. }
  146. .axios-loading2 {
  147. animation: axiosloading 1s;
  148. background-image: url('/src/assets/images/loading.gif');
  149. -webkit-background-image: url('/src/assets/images/loading.gif');
  150. background-repeat: no-repeat;
  151. background-position: center;
  152. }
  153. .el-dialog__header {
  154. border-bottom: 1px solid #ebeef5;
  155. background-color: #f8f8f8;
  156. border-radius: 4px;
  157. }
  158. .el-dialog {
  159. border-radius: 4px;
  160. }
  161. @keyframes axiosloading {
  162. 0% {
  163. opacity: 0;
  164. }
  165. 99% {
  166. opacity: 0;
  167. }
  168. 100% {
  169. opacity: 1;
  170. }
  171. }
  172. .component-box-wrapper__fullscreen {
  173. position: fixed;
  174. top: 0;
  175. left: 0;
  176. bottom: 0;
  177. right: 0;
  178. background: white;
  179. padding: 20px;
  180. z-index: 10000;
  181. height: 100%;
  182. overflow: auto;
  183. }
  184. .component-box-wrapper__half-transparent {
  185. position: fixed;
  186. top: 0;
  187. left: 0;
  188. bottom: 0;
  189. right: 0;
  190. background: rgba(0, 0, 0, 0.7);
  191. padding: 20px;
  192. z-index: 1000;
  193. height: 100%;
  194. overflow: auto;
  195. display: flex;
  196. align-items: flex-start;
  197. justify-content: center;
  198. }
  199. .finger:hover {
  200. cursor: pointer;
  201. }
  202. .component-content-box__dialog-like {
  203. width: 60%;
  204. padding: 20px;
  205. background: white;
  206. margin-top: 15vh;
  207. }
  208. .component-header-box {
  209. position: relative;
  210. width: 100%;
  211. display: flex;
  212. padding: 0 0 12px 0;
  213. }
  214. .component-header__title {
  215. width: 70%;
  216. font-size: 16px;
  217. display: flex;
  218. align-items: center;
  219. }
  220. .component-header__close-button {
  221. width: 30%;
  222. text-align: right;
  223. }
  224. table th.star div::before {
  225. content: '*';
  226. color: #f56c6cff;
  227. margin-right: 4px;
  228. }
  229. .bi_tian .el-form-item__label::before {
  230. content: '*';
  231. color: #f56c6cff;
  232. margin-right: 4px;
  233. }
  234. .el-select-dropdown__item.selected {
  235. background-color: #71abed66;
  236. }
  237. .el-select-dropdown__item.hover,
  238. .el-select-dropdown__item:hover {
  239. background-color: #fac44d;
  240. color: white;
  241. }
  242. .el-message {
  243. border: none;
  244. border-radius: 2px;
  245. background-color: white;
  246. padding: 10px 16px;
  247. box-shadow: 1px 3px 8px 4px rgb(0 0 0 / 10%);
  248. .el-message__content {
  249. color: #333333;
  250. }
  251. }
  252. </style>