AppMain.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <section class="app-main">
  3. <transition name="fade-transform" mode="out-in">
  4. <keep-alive :include="cachedViews">
  5. <router-view :key="key" />
  6. </keep-alive>
  7. </transition>
  8. <div class="tkbox" v-if="open">
  9. <div class="tkbox-title">
  10. <div class="tkbox-title-left">
  11. <img src="../../assets/images/八一.png" alt />
  12. <span>重要消息</span>
  13. </div>
  14. <div class="tkbox-title-right">
  15. <img src="../../assets/images/关闭.png" alt @click="showfun" />
  16. </div>
  17. </div>
  18. <div class="tkbox-main">
  19. <p>
  20. <img src="../../assets/images/警示.png" alt />
  21. <span>{{title}}</span>
  22. </p>
  23. </div>
  24. <div class="tkbox-footer">
  25. <el-button type="primary" @click="quchulifun">去处理</el-button>
  26. </div>
  27. </div>
  28. </section>
  29. </template>
  30. <script>
  31. import { printTrigger, printTriggerClear } from "@/api/PrintsManage/manage";
  32. import Cookies from "js-cookie";
  33. export default {
  34. name: "AppMain",
  35. data() {
  36. return {
  37. open: false,
  38. timer: null,
  39. title: ""
  40. };
  41. },
  42. created() {
  43. this.timer = null;
  44. this.startTime();
  45. },
  46. computed: {
  47. cachedViews() {
  48. return this.$store.state.tagsView.cachedViews;
  49. },
  50. key() {
  51. return this.$route.path;
  52. }
  53. },
  54. methods: {
  55. showfun() {
  56. printTriggerClear().then(res => {
  57. // console.log(res)
  58. });
  59. this.open = false;
  60. },
  61. quchulifun() {
  62. printTriggerClear().then(res => {
  63. if (res.code == 200) {
  64. window.open(`/print/manage`, "_self");
  65. }
  66. });
  67. },
  68. startTime() {
  69. this.timer = setInterval(() => {
  70. printTrigger().then(res => {
  71. if (res.code == 200) {
  72. if (res.printInfo_u != 0) {
  73. var sendId = Cookies.get("userId");
  74. if (res.printUserInfo == sendId) {
  75. this.title = res.msg;
  76. this.open = true;
  77. }
  78. if (res.printInfo == sendId) {
  79. // this.title = res.msg;
  80. this.title = "您有打印文件需要处理,请尽快处理";
  81. this.open = true;
  82. }
  83. }
  84. }
  85. });
  86. }, 10000); /* 每500毫秒执行一次,实现动态显示时间效果 */
  87. }
  88. },
  89. destroyed() {
  90. clearInterval(this.timer); // 清除定时器
  91. this.timer = null;
  92. }
  93. };
  94. </script>
  95. <style lang="scss" scoped>
  96. .app-main {
  97. /* 50= navbar 50 */
  98. min-height: calc(100vh - 50px);
  99. width: 100%;
  100. position: relative;
  101. overflow: hidden;
  102. position: relative;
  103. }
  104. .tkbox {
  105. width: 500px;
  106. height: 220px;
  107. background-image: url("../../assets/images/框.png");
  108. background-size: 100% 100%;
  109. background-repeat: no-repeat;
  110. position: absolute;
  111. left: 30%;
  112. top: 30%;
  113. }
  114. .tkbox-title {
  115. width: 100%;
  116. height: 90px;
  117. display: flex;
  118. flex-direction: row;
  119. }
  120. .tkbox-title-left {
  121. flex: 3;
  122. display: flex;
  123. align-items: center;
  124. }
  125. .tkbox-title-left img {
  126. margin-right: 10px;
  127. width: 30px;
  128. height: 30px;
  129. margin-left: 35px;
  130. display: inline-block;
  131. }
  132. .tkbox-title-left span {
  133. color: #fff;
  134. }
  135. .tkbox-title-right {
  136. flex: 1;
  137. display: flex;
  138. justify-content: right;
  139. align-items: center;
  140. margin-right: 35px;
  141. }
  142. .tkbox-main {
  143. width: 100%;
  144. height: 60px;
  145. }
  146. .tkbox-main p {
  147. width: 90%;
  148. height: auto;
  149. margin: 0 auto;
  150. color: #fff;
  151. font-size: 14px;
  152. display: flex;
  153. align-items: center;
  154. justify-content: center;
  155. }
  156. .tkbox-main p span {
  157. margin-left: 10px;
  158. }
  159. .tkbox-footer {
  160. width: 100%;
  161. height: 30px;
  162. margin-bottom: 30px;
  163. text-align: center;
  164. }
  165. .fixed-header + .app-main {
  166. padding-top: 50px;
  167. }
  168. .hasTagsView {
  169. .app-main {
  170. /* 84 = navbar + tags-view = 50 + 34 */
  171. min-height: calc(100vh - 84px);
  172. }
  173. .fixed-header + .app-main {
  174. padding-top: 84px;
  175. }
  176. }
  177. </style>
  178. <style lang="scss">
  179. // fix css style bug in open el-dialog
  180. .el-popup-parent--hidden {
  181. .fixed-header {
  182. padding-right: 17px;
  183. }
  184. }
  185. // 设置背景颜色
  186. .app-main {
  187. background: #022845;
  188. }
  189. // 头部背景颜色、字体颜色
  190. .navbar {
  191. background: #114a80 !important;
  192. color: #fff !important;
  193. // box-shadow:5px 5px 10px black;
  194. border-bottom: 1px solid #15324e;
  195. }
  196. .el-scrollbar__view {
  197. background-color: #114a80;
  198. }
  199. .app-breadcrumb.el-breadcrumb .no-redirect {
  200. color: #fff !important;
  201. }
  202. .el-breadcrumb__inner a {
  203. color: #fff !important;
  204. }
  205. .tags-view-container {
  206. background: #022845 !important;
  207. border: 0px !important;
  208. }
  209. .navbar .right-menu .avatar-container .avatar-wrapper .el-icon-caret-bottom {
  210. color: #fff !important;
  211. }
  212. .navbar .right-menu .right-menu-item {
  213. color: #fff !important;
  214. }
  215. // 设置主题内外边距
  216. .app-container {
  217. margin: 10px 10px 10px 10px;
  218. padding: 15px 15px 15px 15px;
  219. }
  220. </style>