teacherHome.vue 11 KB

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