App.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <div id="app" @click="handleClick">
  3. <router-view />
  4. </div>
  5. </template>
  6. <script>
  7. import { getToken, setToken } from '@/utils/auth';
  8. export default {
  9. name: 'App',
  10. data() {
  11. return {
  12. lastTime: null,
  13. currentTime: null,
  14. timeOut: 0.5 * 3600000,
  15. token: '',
  16. timer: '',
  17. };
  18. },
  19. mounted() {
  20. this.lastTime = new Date().getTime();
  21. this.token = getToken();
  22. },
  23. methods: {
  24. handleClick() {
  25. setTimeout(() => {
  26. this.lastTime = new Date().getTime();
  27. if (this.$route.path.includes('/hospital') || this.$route.path.includes('/embedIndex')) {
  28. clearInterval(this.timer);
  29. this.timer = setInterval(this.isTimeOut, 1000);
  30. } else {
  31. clearInterval(this.timer);
  32. this.lastTime = new Date().getTime();
  33. }
  34. }, 1000);
  35. },
  36. isTimeOut() {
  37. this.currentTime = new Date().getTime();
  38. console.log(6666)
  39. // 判断上次最后一次点击的时间和这次点击的时间间隔是否大于30分钟
  40. if (this.currentTime - this.lastTime > this.timeOut) {
  41. if (null != this.token) {
  42. // 是否是登录状态
  43. clearInterval(this.timer);
  44. this.$message.info('30分钟内无操作,请重新登录。');
  45. setToken('');
  46. sessionStorage.removeItem('route');
  47. this.$router.push({ path: `/login` });
  48. } else {
  49. this.lastTime = new Date().getTime();
  50. }
  51. }
  52. },
  53. },
  54. };
  55. </script>
  56. <style>
  57. * {
  58. font-size: 14px;
  59. margin: 0;
  60. padding: 0;
  61. }
  62. .eInput {
  63. /* width:350px; */
  64. border: none !important;
  65. }
  66. /* 三种方法选择自己喜欢的一个即可 */
  67. /* .el-input--prefix .el-input__inner{
  68. border: none;
  69. } */
  70. /* .el-input--small .el-input__inner {
  71. border: none;
  72. } */
  73. /* .textMsg {
  74. position: absolute;
  75. top: 80px;
  76. cursor: pointer;
  77. left: 3px;
  78. } */
  79. /* 重写input */
  80. .row-bg {
  81. width: 100%;
  82. }
  83. .flexTable .el-input__inner {
  84. border-top: none !important;
  85. border-left: none !important;
  86. border-right: none !important;
  87. margin-bottom: 2px;
  88. border-radius: 0px !important;
  89. }
  90. .tableReach .el-input__inner {
  91. border-top: none !important;
  92. border-left: none !important;
  93. border-right: none !important;
  94. border-radius: 0px !important;
  95. border-bottom: 1px solid #f5f5f5 !important;
  96. }
  97. .tableReaches .el-input__inner {
  98. border-top: none !important;
  99. border-left: none !important;
  100. border-right: none !important;
  101. height: 30px !important;
  102. line-height: 30px !important;
  103. border-bottom: 0.5px solid #f5f5f5 !important;
  104. border-radius: 0px !important;
  105. }
  106. .tableReachCCC .el-input__inner {
  107. border-top: none !important;
  108. border-left: none !important;
  109. border-right: none !important;
  110. border-radius: 0px !important;
  111. border-bottom: 0.5px solid #f5f5f5 !important;
  112. }
  113. #hh .el-input__inner {
  114. border-top: 0px !important;
  115. border-left: 0px !important;
  116. border-right: 0px !important;
  117. border-radius: 0px !important;
  118. border-bottom: 1px solid #ccc !important;
  119. }
  120. .flexView {
  121. display: flex;
  122. width: 100%;
  123. align-items: center;
  124. justify-content: center;
  125. }
  126. .tabright .el-input__inner {
  127. border-top: none !important;
  128. border-left: none !important;
  129. border-right: 0.5px !important;
  130. border-bottom: none !important;
  131. }
  132. .tableReachInput .flexView div {
  133. width: 33%;
  134. }
  135. .refachInput {
  136. display: flex;
  137. }
  138. .tablex td {
  139. border-top: none !important;
  140. border-left: none !important;
  141. border-right: none !important;
  142. }
  143. .tablexs span {
  144. font-size: 12px !important;
  145. }
  146. .refachInput span {
  147. height: 40px;
  148. line-height: 40px;
  149. font-weight: bold;
  150. text-align: left;
  151. display: inline-block;
  152. }
  153. .tred td {
  154. border-top: none !important;
  155. border-left: none !important;
  156. border-right: none !important;
  157. }
  158. .refachInput .el-input__inner {
  159. border-top: none !important;
  160. border-left: none !important;
  161. border-right: none !important;
  162. margin-bottom: 2px;
  163. border-radius: 0px !important;
  164. }
  165. .msgBoxDetail span {
  166. margin-left: 10px;
  167. }
  168. /* 质控下拉append */
  169. .zkSelect {
  170. display: inline-block;
  171. }
  172. .zkSelect .el-input-group__append {
  173. border-left: 0;
  174. width: 62px !important;
  175. }
  176. .flextab {
  177. display: flex;
  178. align-items: center;
  179. justify-content: space-between;
  180. margin: 10px 0px;
  181. }
  182. .dashboard-container {
  183. padding: 0;
  184. margin: 0 16px 16px 16px !important;
  185. }
  186. </style>