teacherHome.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. <!-- 教师首页 -->
  2. <template>
  3. <view class="teacherHome">
  4. <dataBoard v-if="pageType == 1" style="display: flex;flex-direction:column;flex:1;"></dataBoard>
  5. <view class="home-page" v-if="pageType == 2">
  6. <nav-bar :title="title" :background="background"></nav-bar>
  7. <view class="top-back-img" :style="{top:navHeight+'rpx'}">
  8. <img class="position-data-button" @click="goPage('dataBoard')" v-if="dataPageType" :src="imagesUrl('home/icon_sy_sjmb@1x.png')">
  9. <img class="position-img" :src="rectangleLogo">
  10. </view>
  11. <view class="button-one-box">
  12. <view class="button-min" @click="goPage('securityCheck')">
  13. <img class="button-img" :src="imagesUrl('home/icon_sy_aqjc@1x.png')">
  14. <view class="button-name">安全检查</view>
  15. </view>
  16. <view class="button-min" @click="goPage('securityExamination')">
  17. <img class="button-img" :src="imagesUrl('home/icon_sy_aqks@1x.png')">
  18. <view class="button-name">安全考试</view>
  19. </view>
  20. <view class="button-min" @click="goPage('securityAdmittance')">
  21. <img class="button-img" :src="imagesUrl('home/icon_sy_aqzr@1x.png')">
  22. <view class="button-name">安全准入</view>
  23. </view>
  24. <view class="button-min" @click="goPage('hierarchicalControl')">
  25. <img class="button-img" :src="imagesUrl('home/icon_sy_fjgk@1x.png')">
  26. <view class="button-name">分级管控</view>
  27. </view>
  28. <view class="button-min" @click="goPage('securityResponsibility')">
  29. <img class="button-img" :src="imagesUrl('home/icon_sy_aqzrr@1x.png')">
  30. <view class="button-name">安全责任</view>
  31. </view>
  32. <view class="button-min" @click="goPage('deviceManagement')">
  33. <img class="button-img" :src="imagesUrl('home/icon_sy_sbgl@1x.png')">
  34. <view class="button-name">设备管理</view>
  35. </view>
  36. <view class="button-min" @click="goPage('emergencyDisposal')">
  37. <img class="button-img" :src="imagesUrl('home/icon_sy_yjcz@1x.png')">
  38. <view class="button-name">应急处置</view>
  39. </view>
  40. <view class="button-min" @click="goPage('cageSiteManagement')">
  41. <img class="button-img" :src="imagesUrl('home/icon_sy_lwgl@1x.png')">
  42. <view class="button-name">笼位管理</view>
  43. </view>
  44. </view>
  45. <topWarn></topWarn>
  46. <view class="button-two-box">
  47. <view class="button-big-box" @click="goPage('snapshot')"
  48. style="background-color: #DFF0FF;margin-right:20rpx;">
  49. <img :src="imagesUrl('home/icon_sy_ssp@1x.png')">
  50. <view class="button-min-box">
  51. <view>随手拍</view>
  52. <view>发现隐患</view>
  53. </view>
  54. </view>
  55. <view class="button-big-box" @click="goPage('remoteDoorOpening')" style="background-color: #D6EBDA;">
  56. <img :src="imagesUrl('home/img_sy_yckm@1x.png')">
  57. <view class="button-min-box">
  58. <view>远程开门</view>
  59. <view>立即开门</view>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="button-three-box-1">
  64. <view class="button-big-box" @click="goPage('leaveCheckPupilTeacher')">
  65. <img :src="imagesUrl('home/img_lkjc@1x.png')">
  66. <view class="button-min-box">
  67. <view>离开检查</view>
  68. <view>拍照检查</view>
  69. </view>
  70. </view>
  71. </view>
  72. <!-- <view class="button-three-box">
  73. <view class="button-big-box" @click="goPage()">
  74. <img :src="imagesUrl('home/img_bg_hxpgk@1x.png')">
  75. <view class="button-min-box">
  76. <view>化学品智能管控</view>
  77. <view>申购审批丨使用台账丨实验室库存</view>
  78. </view>
  79. </view>
  80. </view> -->
  81. <img class="scan_btn" @click.stop="saoCode" :src="imagesUrl('commonality/icon_xyxc_sm.png')">
  82. <tab-bar></tab-bar>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. import {
  88. pageRestrictVerify
  89. } from '@/utils/index'
  90. import {
  91. chemicalAppletSelectStockInfo,
  92. laboratorySubPassOutIsotopeSubSign,
  93. } from '@/pages/api/index.js'
  94. import {
  95. tabBar
  96. } from '@/pages/component/tabBar.vue'
  97. import {
  98. navBar
  99. } from '@/pages/component/navbar.vue'
  100. import {
  101. topWarn
  102. } from '@/pages/component/topWarn.vue'
  103. import {
  104. dataBoard
  105. } from '@/pages/views/dataBoard/dataBoard.vue'
  106. export default {
  107. name: "teacherHome",
  108. components: {
  109. tabBar,
  110. navBar,
  111. topWarn,
  112. dataBoard,
  113. },
  114. data() {
  115. return {
  116. pageType: 2,
  117. navHeight: uni.getStorageSync('navHeight'),
  118. dataPageType: false,
  119. title: '实验室安全智慧化管控系统',
  120. background: '#0183FA',
  121. rectangleLogo: uni.getStorageSync('rectangleLogo'),
  122. identityData:uni.getStorageSync('identityData'),
  123. }
  124. },
  125. created() {
  126. if (pageRestrictVerify('dataBoard')) {
  127. this.dataPageType = true;
  128. if (!uni.getStorageSync('dataBoardType')) {
  129. this.pageType = 1;
  130. uni.setStorageSync('dataBoardType', true);
  131. }
  132. }
  133. },
  134. mounted() {
  135. },
  136. methods: {
  137. goHome() {
  138. this.pageType = 2;
  139. },
  140. goPage(type) {
  141. if (!type) {
  142. uni.showToast({
  143. title: '暂未开放',
  144. icon: "none",
  145. mask: true,
  146. duration: 2000
  147. });
  148. return
  149. }
  150. if (!pageRestrictVerify(type)) {
  151. uni.showToast({
  152. title: '没有相关权限,请联系管理员',
  153. icon: "none",
  154. mask: true,
  155. duration: 2000
  156. });
  157. return
  158. }
  159. if (type == 'dataBoard') {
  160. //数据看板
  161. this.pageType = 1;
  162. } else if (type == 'securityCheck') {
  163. //安全检查
  164. uni.navigateTo({
  165. url: "/pages_safetyCheck/views/safetyCheck",
  166. });
  167. /* if(this.identityData){
  168. uni.navigateTo({
  169. url: "/pages_safetyCheck/views/safetyCheck",
  170. });
  171. }else{
  172. uni.showToast({
  173. mask: true,
  174. icon: "none",
  175. position: "center",
  176. title: '您不是校/院级管理员或督导组成员,无法使用该功能.',
  177. duration: 2000
  178. });
  179. } */
  180. } else if (type == 'securityExamination') {
  181. //安全考试
  182. uni.navigateTo({
  183. url: "/pages_basics/views/deviceCageSitePage?pageType=3",
  184. });
  185. } else if (type == 'securityAdmittance') {
  186. //安全准入
  187. uni.navigateTo({
  188. url: "/pages_manage/views/accessQualification/accessQualification",
  189. });
  190. } else if (type == 'hierarchicalControl') {
  191. //分级管控
  192. uni.navigateTo({
  193. url: "/pages_basics/views/gradingControl/gradingControl",
  194. });
  195. } else if (type == 'securityResponsibility') {
  196. //安全责任
  197. uni.navigateTo({
  198. url: "/pages_basics/views/deviceCageSitePage?pageType=4",
  199. });
  200. } else if (type == 'deviceManagement') {
  201. //设备管理
  202. uni.navigateTo({
  203. url: "/pages_basics/views/deviceCageSitePage?pageType=1",
  204. });
  205. } else if (type == 'emergencyDisposal') {
  206. //应急处置
  207. // uni.navigateTo({
  208. // url: "/pages_manage/views/emergencyEvacuationBig",
  209. // });
  210. uni.navigateTo({
  211. url: "/pages_manage/views/emergencyEvacuationSubList",
  212. });
  213. } else if (type == 'cageSiteManagement') {
  214. //笼位管理
  215. uni.navigateTo({
  216. url: "/pages_basics/views/deviceCageSitePage?pageType=2",
  217. });
  218. } else if (type == 'snapshot') {
  219. //随手拍
  220. uni.navigateTo({
  221. url: "/pages_safetyCheck/views/snapshotManage/snapshotList",
  222. });
  223. /* uni.navigateTo({
  224. url: "/pages_safetyExamine/views/snapshotManage/snapshotAdd",
  225. }); */
  226. } else if (type == 'remoteDoorOpening') {
  227. //远程开门
  228. uni.navigateTo({
  229. url: "/pages_manage/views/accessControl/remoteOpen",
  230. });
  231. } else if (type == 'leaveCheckPupilTeacher') {
  232. //离开检查
  233. uni.navigateTo({
  234. url: "/pages_basics/views/photoInspection",
  235. });
  236. } else if (type == 'chemicalsManagement') {
  237. //化学品管控
  238. }
  239. },
  240. /* 扫一扫*/
  241. saoCode() {
  242. let self = this;
  243. uni.scanCode({
  244. onlyFromCamera: true,
  245. success: function(res) {
  246. if(res.result.indexOf('type') != -1){
  247. //项目二维码
  248. let list = res.result.split("?")[1].split("&");
  249. let codeData = {};
  250. list.forEach((item) => {
  251. codeData[item.split("=")[0]] = item.split("=")[1];
  252. })
  253. if (codeData.type == 1 || codeData.type == 2 || codeData.type == 3 || codeData.type == 7 ||
  254. codeData.type == 8 || codeData.type == 10 ||
  255. codeData.type == 11 || codeData.type == 12 || codeData.type == 13 || codeData.type == 14) {
  256. uni.reLaunch({
  257. url: '/pages/views/saoCode/saoCode?q=' + encodeURIComponent(res.result)
  258. });
  259. }else if(codeData.type == 5){
  260. self.laboratorySubPassOutIsotopeSubSign(codeData.subId,res.result);
  261. }else if(codeData.type == 9){
  262. self.chemicalAppletSelectStockInfo(codeData.code);
  263. }
  264. }else{
  265. self.chemicalAppletSelectStockInfo(res.result);
  266. }
  267. }
  268. });
  269. },
  270. //扫码查询-化学品基本信息
  271. async chemicalAppletSelectStockInfo(code) {
  272. const {
  273. data
  274. } = await chemicalAppletSelectStockInfo({tagCode:code});
  275. if (data.code == 200) {
  276. if(data.data){
  277. data.data.code = code;
  278. //化学品信息
  279. uni.navigateTo({
  280. url: "/pages_basics/views/chemicalsInfo/chemicalsInfo?item=" + encodeURIComponent(JSON.stringify(data.data)),
  281. });
  282. }else{
  283. uni.showToast({
  284. mask: true,
  285. icon: "none",
  286. position: "center",
  287. title: '未找到相关信息,请扫描正确的二维码',
  288. duration: 2000
  289. });
  290. }
  291. }
  292. },
  293. //查询是否是同位素实验并且有签退
  294. async laboratorySubPassOutIsotopeSubSign(subId,result) {
  295. const {
  296. data
  297. } = await laboratorySubPassOutIsotopeSubSign({subId:subId});
  298. if (data.code == 200) {
  299. if(data.data.isotope){
  300. let obj = {
  301. subId:subId,
  302. subName:data.data.subName,
  303. passOutId:data.data.passOutId,
  304. }
  305. uni.navigateTo({
  306. url: "/pages_basics/views/photoInspection?item=" + encodeURIComponent(JSON.stringify(obj)),
  307. });
  308. }else{
  309. uni.reLaunch({
  310. url: '/pages/views/saoCode/saoCode?q=' + encodeURIComponent(result)
  311. });
  312. }
  313. }
  314. },
  315. }
  316. }
  317. </script>
  318. <style lang="stylus" scoped>
  319. @import '@/api/request/imagesUrl.styl';
  320. .teacherHome {
  321. flex: 1;
  322. display: flex;
  323. flex-direction: column;
  324. overflow: hidden;
  325. .data-board {
  326. flex: 1;
  327. display: flex;
  328. flex-direction: column;
  329. overflow: hidden;
  330. }
  331. .home-page {
  332. flex: 1;
  333. display: flex;
  334. flex-direction: column;
  335. overflow-y: scroll;
  336. overflow-x: hidden;
  337. padding-bottom:120rpx;
  338. .top-page-title {
  339. text-align: center;
  340. font-size: 28rpx;
  341. background-color: #0183FA;
  342. color: #fff;
  343. }
  344. .top-back-img {
  345. position: absolute;
  346. top: 0;
  347. left: 0;
  348. width: 750rpx;
  349. height: 539rpx;
  350. background: url($imagesUrl+'home/img_sy_bg@1x.png') no-repeat;
  351. background-size:100%;
  352. background-repeat: no-repeat;
  353. .position-img {
  354. z-index: 5;
  355. position: absolute;
  356. left: 0;
  357. top: 10rpx;
  358. width: 400rpx;
  359. height: 88rpx;
  360. }
  361. .position-data-button {
  362. z-index: 5;
  363. position: fixed;
  364. right: 0;
  365. top: 180rpx;
  366. width: 130rpx;
  367. height: 109rpx;
  368. /* line-height: 50rpx;
  369. background-color: #0183fa;
  370. color: #fff;
  371. font-size: 28rpx;
  372. text-align: center;
  373. border-top-left-radius: 30rpx;
  374. border-bottom-left-radius: 30rpx; */
  375. }
  376. }
  377. .button-one-box {
  378. z-index: 5;
  379. background: #fff;
  380. width: 690rpx;
  381. border-radius: 20rpx;
  382. padding: 13px 0 20px;
  383. overflow: hidden;
  384. margin: 490rpx 30rpx 0;
  385. .button-min {
  386. display: inline-block;
  387. overflow: hidden;
  388. width: 172rpx;
  389. height: 123rpx;
  390. margin-top: 23rpx;
  391. .button-img {
  392. display: block;
  393. width: 80rpx;
  394. height: 80rpx;
  395. margin: 0 auto;
  396. }
  397. .button-name {
  398. margin-top: 15rpx;
  399. height: 28rpx;
  400. line-height: 28rpx;
  401. font-size: 28rpx;
  402. text-align: center;
  403. color: #333;
  404. }
  405. }
  406. }
  407. .button-two-box {
  408. z-index: 5;
  409. width: 690rpx;
  410. height: 120rpx;
  411. display: flex;
  412. margin: 20rpx 30rpx 0;
  413. .button-big-box {
  414. width: 335rpx;
  415. display: flex;
  416. border-radius: 20rpx;
  417. img {
  418. display: block;
  419. margin: 20rpx 31rpx 0 36rpx;
  420. height: 80rpx;
  421. width: 80rpx;
  422. }
  423. .button-min-box {
  424. view:nth-child(1) {
  425. line-height: 32rpx;
  426. height: 32rpx;
  427. font-size: 32rpx;
  428. color: #333;
  429. margin: 20rpx 0 18rpx;
  430. }
  431. view:nth-child(2) {
  432. line-height: 28rpx;
  433. height: 28rpx;
  434. font-size: 28rpx;
  435. color: #999;
  436. }
  437. }
  438. }
  439. }
  440. .button-three-box-1 {
  441. z-index: 5;
  442. width: 690rpx;
  443. height: 130rpx;
  444. margin: 20rpx 30rpx 0;
  445. .button-big-box {
  446. border-radius: 20rpx;
  447. background-color: #CDE7FF;
  448. display: flex;
  449. img {
  450. display: block;
  451. width: 134rpx;
  452. height: 104rpx;
  453. margin: 23rpx 34rpx 0 30rpx;
  454. }
  455. .button-min-box {
  456. view:nth-child(1) {
  457. line-height: 30rpx;
  458. height: 30rpx;
  459. font-size: 30rpx;
  460. color: #0183FA;
  461. margin: 27rpx 0 15rpx;
  462. }
  463. view:nth-child(2) {
  464. line-height: 26rpx;
  465. height: 26rpx;
  466. font-size: 26rpx;
  467. color: #666666;
  468. }
  469. }
  470. }
  471. }
  472. .button-three-box {
  473. z-index: 5;
  474. width: 690rpx;
  475. height: 130rpx;
  476. margin: 20rpx 30rpx 0;
  477. .button-big-box {
  478. border-radius: 20rpx;
  479. background-color: #FFF0DD;
  480. display: flex;
  481. img {
  482. display: block;
  483. width: 134rpx;
  484. height: 104rpx;
  485. margin: 23rpx 34rpx 0 30rpx;
  486. }
  487. .button-min-box {
  488. view:nth-child(1) {
  489. line-height: 30rpx;
  490. height: 30rpx;
  491. font-size: 30rpx;
  492. color: #FF8C00;
  493. margin: 27rpx 0 15rpx;
  494. }
  495. view:nth-child(2) {
  496. line-height: 26rpx;
  497. height: 26rpx;
  498. font-size: 26rpx;
  499. color: #666666;
  500. }
  501. }
  502. }
  503. }
  504. .scan_btn {
  505. z-index: 10;
  506. position: fixed;
  507. bottom: 210rpx;
  508. right: 0rpx;
  509. width: 140rpx;
  510. height: 140rpx;
  511. }
  512. }
  513. }
  514. </style>