pupilHome.vue 14 KB

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