App.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. #app {
  63. position: relative;
  64. }
  65. .eInput {
  66. /* width:350px; */
  67. border: none !important;
  68. }
  69. /* 三种方法选择自己喜欢的一个即可 */
  70. /* .el-input--prefix .el-input__inner{
  71. border: none;
  72. } */
  73. /* .el-input--small .el-input__inner {
  74. border: none;
  75. } */
  76. /* .textMsg {
  77. position: absolute;
  78. top: 80px;
  79. cursor: pointer;
  80. left: 3px;
  81. } */
  82. /* 重写input */
  83. .row-bg {
  84. width: 100%;
  85. }
  86. .flexTable .el-input__inner {
  87. border-top: none !important;
  88. border-left: none !important;
  89. border-right: none !important;
  90. margin-bottom: 2px;
  91. border-radius: 0px !important;
  92. }
  93. .tableReach .el-input__inner {
  94. border-top: none !important;
  95. border-left: none !important;
  96. border-right: none !important;
  97. border-radius: 0px !important;
  98. border-bottom: 1px solid #f5f5f5 !important;
  99. }
  100. .tableReaches .el-input__inner {
  101. border-top: none !important;
  102. border-left: none !important;
  103. border-right: none !important;
  104. height: 30px !important;
  105. line-height: 30px !important;
  106. border-bottom: 0.5px solid #f5f5f5 !important;
  107. border-radius: 0px !important;
  108. }
  109. .tableReachCCC .el-input__inner {
  110. border-top: none !important;
  111. border-left: none !important;
  112. border-right: none !important;
  113. border-radius: 0px !important;
  114. border-bottom: 0.5px solid #f5f5f5 !important;
  115. }
  116. #hh .el-input__inner {
  117. border-top: 0px !important;
  118. border-left: 0px !important;
  119. border-right: 0px !important;
  120. border-radius: 0px !important;
  121. border-bottom: 1px solid #ccc !important;
  122. }
  123. .flexView {
  124. display: flex;
  125. width: 100%;
  126. align-items: center;
  127. justify-content: center;
  128. }
  129. .tabright .el-input__inner {
  130. border-top: none !important;
  131. border-left: none !important;
  132. border-right: 0.5px !important;
  133. border-bottom: none !important;
  134. }
  135. .tableReachInput .flexView div {
  136. width: 33%;
  137. }
  138. .refachInput {
  139. display: flex;
  140. }
  141. .tablex td {
  142. border-top: none !important;
  143. border-left: none !important;
  144. border-right: none !important;
  145. }
  146. .tablexs span {
  147. font-size: 12px !important;
  148. }
  149. .refachInput span {
  150. height: 40px;
  151. line-height: 40px;
  152. font-weight: bold;
  153. text-align: left;
  154. display: inline-block;
  155. }
  156. .tred td {
  157. border-top: none !important;
  158. border-left: none !important;
  159. border-right: none !important;
  160. }
  161. .refachInput .el-input__inner {
  162. border-top: none !important;
  163. border-left: none !important;
  164. border-right: none !important;
  165. margin-bottom: 2px;
  166. border-radius: 0px !important;
  167. }
  168. .msgBoxDetail span {
  169. margin-left: 10px;
  170. }
  171. /* 质控下拉append */
  172. .zkSelect {
  173. display: inline-block;
  174. }
  175. .zkSelect .el-input-group__append {
  176. border-left: 0;
  177. width: 62px !important;
  178. }
  179. .flextab {
  180. display: flex;
  181. align-items: center;
  182. justify-content: space-between;
  183. margin: 10px 0px;
  184. }
  185. .dashboard-container {
  186. padding: 0;
  187. margin: 0 16px 16px 16px !important;
  188. }
  189. </style>