teacherHome.vue 11 KB

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