华西海圻ELN前端工程
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

473 lines
8.9 KiB

4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
  1. <template>
  2. <div id="app">
  3. <router-view />
  4. <theme-picker />
  5. </div>
  6. </template>
  7. <script>
  8. import ThemePicker from "@/components/ThemePicker"
  9. import { checkStatus } from "@/api/system/user"
  10. export default {
  11. name: "App",
  12. components: { ThemePicker },
  13. data() {
  14. return {
  15. statusCheckTimer: null
  16. }
  17. },
  18. computed: {
  19. // // 监听登录状态
  20. // isLoggedIn() {
  21. // return this.$store.getters.token && this.$store.getters.token !== ''
  22. // }
  23. },
  24. watch: {
  25. // // 监听登录状态变化
  26. // isLoggedIn(newVal, oldVal) {
  27. // console.log('登录状态变化:', newVal, oldVal)
  28. // if (newVal) {
  29. // // 用户已登录,启动轮询
  30. // this.startStatusCheck()
  31. // } else {
  32. // // 用户已退出,停止轮询
  33. // this.stopStatusCheck()
  34. // }
  35. // },
  36. // 监听token
  37. '$store.getters.token': {
  38. handler(newToken, oldToken) {
  39. console.log('token变化:', newToken, oldToken)
  40. if (newToken) {
  41. // 有token,启动轮询
  42. this.startStatusCheck()
  43. } else {
  44. // token为空,停止轮询
  45. this.stopStatusCheck()
  46. }
  47. },
  48. immediate: true // 立即执行一次,这样在页面刷新时,如果已经有token,就会启动轮询
  49. }
  50. },
  51. mounted() {
  52. // // 页面加载时检查当前登录状态
  53. // if (this.isLoggedIn) {
  54. // this.startStatusCheck()
  55. // }
  56. },
  57. beforeDestroy() {
  58. this.stopStatusCheck()
  59. },
  60. methods: {
  61. startStatusCheck() {
  62. // 先停止可能存在的定时器
  63. this.stopStatusCheck()
  64. console.log('启动状态检查轮询')
  65. // 立即执行一次检查
  66. this.checkStatusImmediate()
  67. // 设置定时器每秒检查一次
  68. this.statusCheckTimer = setInterval(() => {
  69. this.checkStatus()
  70. }, 10000)
  71. },
  72. stopStatusCheck() {
  73. if (this.statusCheckTimer) {
  74. console.log('停止状态检查轮询')
  75. clearInterval(this.statusCheckTimer)
  76. this.statusCheckTimer = null
  77. }
  78. },
  79. // 立即检查(不等待)
  80. async checkStatusImmediate() {
  81. await this.checkStatus()
  82. },
  83. // 定时检查
  84. async checkStatus() {
  85. // 再次确认登录状态
  86. // if (!this.isLoggedIn) {
  87. // this.stopStatusCheck()
  88. // return
  89. // }
  90. try {
  91. console.log('开始checkStatus')
  92. checkStatus().then(response => {
  93. console.log(JSON.stringify(response))
  94. }).catch(err => {
  95. console.log(JSON.stringify(err))
  96. // if (err === '无效的会话,或者会话已过期,请重新登录。') {
  97. if (err === this.$t('system.timeOutTip')) {
  98. this.stopStatusCheck()
  99. }
  100. })
  101. } catch (error) {
  102. }
  103. },
  104. }
  105. }
  106. </script>
  107. <style rel="stylesheet/scss" lang="scss">
  108. #app .theme-picker {
  109. display: none;
  110. }
  111. .el-dialog__header {
  112. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1) !important;
  113. }
  114. .el-dialog__footer {
  115. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1) !important;
  116. }
  117. .el-dialog__body {
  118. padding: 10px 10px;
  119. }
  120. /*隐藏自动填充密码 */
  121. .sbzdtcma{
  122. width: 0px; height: 0px; overflow: hidden;
  123. }
  124. /*搜索区域样式 */
  125. .search-area {
  126. input {
  127. width: 150px;
  128. }
  129. }
  130. .el-tabs--border-card>.el-tabs__content {
  131. padding: 0px 0px;
  132. }
  133. /*详情 */
  134. .detail-container {
  135. background: #ffffff !important;
  136. .detail-top {
  137. background: #fff;
  138. padding: 10px 20px;
  139. margin-bottom: 10px;
  140. display: flex;
  141. flex-direction: row;
  142. align-items: center;
  143. justify-content: space-between;
  144. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  145. .left-top {
  146. flex-shrink: 0;
  147. display: flex;
  148. flex-direction: row;
  149. align-items: center;
  150. img {
  151. height: 16px;
  152. margin-right: 10px;
  153. cursor: pointer;
  154. }
  155. .right-top {}
  156. }
  157. }
  158. .detail-title {
  159. line-height: 60px;
  160. font-size: 16px;
  161. font-weight: bold;
  162. width: 100%;
  163. margin-top: 10px;
  164. display: flex;
  165. justify-content: center;
  166. }
  167. .detail-content {
  168. padding: 10px 10px;
  169. display: flex;
  170. justify-content: space-between;
  171. .content-right {
  172. width: 33%;
  173. margin-left: 2%;
  174. padding: 0px 10px;
  175. border-left: 1px solid #d0d0d0;
  176. }
  177. .content-left {
  178. width: 65%;
  179. }
  180. .content {
  181. width: 100%;
  182. }
  183. .content-title {
  184. width: 100%;
  185. background: #f9f9ff;
  186. font-size: 0.96rem;
  187. font-weight: bold;
  188. padding-left: 10px;
  189. height: 40px;
  190. line-height: 40px;
  191. display: flex;
  192. justify-content: flex-start;
  193. text-align: left;
  194. .line {
  195. width: 2px;
  196. float: left;
  197. height: 16px;
  198. margin-top: 12px;
  199. margin-right: 8px;
  200. border-left: #3178ff 3px solid;
  201. }
  202. .subtitle {
  203. height: 40px;
  204. line-height: 40px;
  205. color: #464647 !important;
  206. }
  207. }
  208. .pal {
  209. display: flex;
  210. justify-content: space-between;
  211. margin: 10px 0px;
  212. .left {
  213. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  214. margin: 5px 5px 5px 0px;
  215. width: 50%;
  216. padding: 10px 10px;
  217. border-radius: 5px 5px;
  218. .left-title {
  219. height: 40px;
  220. line-height: 40px;
  221. }
  222. }
  223. .right {
  224. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  225. margin: 5px 0px 5px 5px;
  226. width: 50%;
  227. padding: 10px 10px;
  228. border-radius: 5px 5px;
  229. .right-title {
  230. height: 40px;
  231. line-height: 40px;
  232. }
  233. }
  234. }
  235. }
  236. }
  237. /*稽查轨迹list */
  238. .jcgjList {
  239. padding: 20px 0px;
  240. .jcgjList-keywords {
  241. width: 100%;
  242. }
  243. .jcgjList-jcgjlx {
  244. height: 50px;
  245. margin: 10px 0px;
  246. }
  247. .jcgjList-content {
  248. width: 100%;
  249. }
  250. .jcgjList-title {
  251. display: flex;
  252. justify-content: space-between;
  253. margin-top: -15px;
  254. .jcgjList-jcmc {
  255. font-size: 16px;
  256. font-weight: bold;
  257. }
  258. }
  259. .jcglList-jcnr {
  260. line-height: 25x;
  261. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  262. padding: 10px 10px;
  263. margin-top: 10px;
  264. }
  265. }
  266. /** 基础信息设置tab **/
  267. .edit-container {
  268. .edit-top {
  269. background: #fff;
  270. padding: 10px 20px;
  271. margin-bottom: 10px;
  272. display: flex;
  273. flex-direction: row;
  274. align-items: center;
  275. justify-content: space-between;
  276. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  277. .left-top {
  278. flex-shrink: 0;
  279. display: flex;
  280. flex-direction: row;
  281. align-items: center;
  282. img {
  283. height: 16px;
  284. margin-right: 10px;
  285. cursor: pointer;
  286. }
  287. }
  288. .center-top {
  289. display: flex;
  290. justify-content: space-between;
  291. height: 24px;
  292. .is-finish {
  293. background: #409eff;
  294. border: 1px solid #409eff;
  295. color: #fff;
  296. }
  297. .is-info {
  298. border: 1px solid #d0d0d0;
  299. }
  300. .line {
  301. height: 0px;
  302. width: 100px;
  303. margin-top: 12px;
  304. margin-left: 5px;
  305. margin-right: 5px;
  306. border-top: 1px solid #d0d0d0;
  307. }
  308. }
  309. .right-top {}
  310. }
  311. .edit-content {
  312. background: #ffffff;
  313. padding: 10px 10px;
  314. margin-top: 10px;
  315. width: 100%;
  316. display: flex;
  317. justify-content: center;
  318. .content-right {
  319. width: 33%;
  320. margin-left: 2%;
  321. padding: 0px 10px;
  322. border-left: 1px solid #d0d0d0;
  323. }
  324. .content-left {
  325. width: 65%;
  326. }
  327. .content {
  328. width: 100%;
  329. }
  330. .content-title {
  331. width: 100%;
  332. background: #f9f9ff;
  333. font-size: 0.96rem;
  334. font-weight: bold;
  335. padding-left: 10px;
  336. height: 40px;
  337. line-height: 40px;
  338. display: flex;
  339. justify-content: flex-start;
  340. text-align: left;
  341. .line {
  342. width: 2px;
  343. float: left;
  344. height: 16px;
  345. margin-top: 12px;
  346. margin-right: 8px;
  347. border-left: #3178ff 3px solid;
  348. }
  349. .subtitle {
  350. height: 40px;
  351. line-height: 40px;
  352. color: #464647 !important;
  353. }
  354. }
  355. .pal {
  356. display: flex;
  357. justify-content: space-between;
  358. margin: 10px 0px;
  359. .left {
  360. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  361. margin: 5px 5px 5px 0px;
  362. width: 50%;
  363. padding: 10px 10px;
  364. border-radius: 5px 5px;
  365. .left-title {
  366. height: 40px;
  367. line-height: 40px;
  368. }
  369. }
  370. .right {
  371. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  372. margin: 5px 0px 5px 5px;
  373. width: 50%;
  374. padding: 10px 10px;
  375. border-radius: 5px 5px;
  376. .right-title {
  377. height: 40px;
  378. line-height: 40px;
  379. }
  380. }
  381. }
  382. }
  383. }
  384. /* 单选,隐藏label */
  385. .hide-label>.el-radio__label {
  386. font-size: 0 !important;
  387. line-height: 0 !important;
  388. }
  389. .template-form-item {
  390. background: #fff;
  391. padding: 20px;
  392. border-radius: 8px;
  393. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  394. margin-top: 24px;
  395. padding: 24px;
  396. }
  397. </style>