teacherHome.vue 12 KB

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