pupilHome.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  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. console.log('type',type)
  141. if (!type) {
  142. uni.showToast({
  143. title: '暂未开放',
  144. icon: "none",
  145. mask: true,
  146. duration: 2000
  147. });
  148. return
  149. }
  150. if(type == 'safetyEducationExamination'){
  151. //教育考试-临时
  152. uni.navigateTo({
  153. url: "/pages_safetyEducationExamination/views/home/index",
  154. });
  155. return
  156. }
  157. if (!pageRestrictVerify(type)) {
  158. uni.showToast({
  159. title: '没有相关权限,请联系管理员',
  160. icon: "none",
  161. mask: true,
  162. duration: 2000
  163. });
  164. return
  165. }
  166. if (type == 'securityExaminationPupil') {
  167. //安全考试
  168. uni.navigateTo({
  169. url: "/pages_basics/views/deviceCageSitePage?pageType=3",
  170. });
  171. } else if (type == 'securityAdmittancePupil') {
  172. //安全准入
  173. uni.navigateTo({
  174. url: "/pages_student/views/accessApplication/safeAccess",
  175. });
  176. }else if (type == 'hierarchicalControlPupil') {
  177. //分级管控
  178. uni.navigateTo({
  179. url: "/pages_basics/views/gradingControl/gradingControl",
  180. });
  181. } else if (type == 'securityCheck') {
  182. //安全检查
  183. uni.navigateTo({
  184. url: "/pages_safetyCheck/views/safetyCheck",
  185. });
  186. } else if (type == 'chemicalsPupil') {
  187. //化学品
  188. } else if (type == 'cageSiteSubscribePupil') {
  189. //笼位预约
  190. uni.navigateTo({
  191. url: "/pages_basics/views/deviceCageSitePage?pageType=2",
  192. });
  193. } else if (type == 'snapshotPupil') {
  194. //随手拍
  195. uni.navigateTo({
  196. url: "/pages_safetyCheck/views/snapshotManage/snapshotList",
  197. });
  198. } else if (type == 'leaveCheckPupil') {
  199. //离开检查
  200. uni.navigateTo({
  201. url: "/pages_basics/views/photoInspection",
  202. });
  203. } else if (type == 'violationRecordPupil') {
  204. //违规记录
  205. uni.navigateTo({
  206. url: "/pages_student/views/meViolation/meViolation",
  207. });
  208. } else if (type == 'facilityReservationPupil'){
  209. //设施预约
  210. uni.navigateTo({
  211. url: "/pages_basics/views/deviceCageSitePage?pageType=5",
  212. });
  213. }else if(type == 'hazardousWasteRecyclingPupil'){
  214. //危废回收
  215. this.systemUserGetPost();
  216. }
  217. },
  218. async systemUserGetPost(){
  219. const {
  220. data
  221. } = await systemUserGetPost();
  222. if (data.code == 200) {
  223. let num = 0;
  224. for(let i=0;i<data.data.length;i++){
  225. if(data.data[i].postCode == 'safe_fzr'){
  226. }else{
  227. if(data.data[i].isPost){
  228. num++
  229. }
  230. }
  231. }
  232. if(num>0){
  233. // 拥有身份
  234. uni.setStorageSync('hazardousWasteUserType',1)
  235. uni.navigateTo({
  236. url: "/pages_hazardousWasteRecycling/views/home/home",
  237. });
  238. }else{
  239. // 没有身份
  240. uni.setStorageSync('hazardousWasteUserType',0)
  241. this.hwmsAppRegisterApprovalIsPermit();
  242. }
  243. }
  244. },
  245. async hwmsAppRegisterApprovalIsPermit(){
  246. const {
  247. data
  248. } = await hwmsAppRegisterApprovalIsPermit();
  249. if (data.code == 200) {
  250. if(data.data == '0'){
  251. //没有权限-跳转权限申请
  252. uni.navigateTo({
  253. url: "/pages_hazardousWasteRecycling/views/permissionApply/index",
  254. });
  255. }else if(data.data == '1'){
  256. //有权限-正常进入
  257. uni.navigateTo({
  258. url: "/pages_hazardousWasteRecycling/views/home/home",
  259. });
  260. }else if(data.data == '2'){
  261. //没有权限-有申请-跳转申请列表
  262. uni.navigateTo({
  263. url: "/pages_hazardousWasteRecycling/views/permissionApply/listPage",
  264. });
  265. }
  266. }
  267. },
  268. /* 扫一扫*/
  269. saoCode() {
  270. let self = this;
  271. uni.scanCode({
  272. onlyFromCamera: true,
  273. success: function(res) {
  274. if(res.result.indexOf('type') != -1){
  275. //项目二维码
  276. let list = res.result.split("?")[1].split("&");
  277. let codeData = {};
  278. list.forEach((item) => {
  279. codeData[item.split("=")[0]] = item.split("=")[1];
  280. })
  281. if (codeData.type == 1 || codeData.type == 2 || codeData.type == 3 || codeData.type == 7 ||
  282. codeData.type == 8 || codeData.type == 10 ||
  283. codeData.type == 11 || codeData.type == 12 || codeData.type == 13 || codeData.type == 14 ||
  284. codeData.type == 'offlineTraining') {
  285. uni.reLaunch({
  286. url: '/pages/views/saoCode/saoCode?q=' + encodeURIComponent(res.result)
  287. });
  288. }else if(codeData.type == 5){
  289. self.laboratorySubPassOutIsotopeSubSign(codeData.subId,res.result);
  290. }else if(codeData.type == 9){
  291. self.chemicalAppletSelectStockInfo(codeData.code);
  292. }
  293. }else{
  294. self.chemicalAppletSelectStockInfo(res.result);
  295. }
  296. }
  297. });
  298. },
  299. //扫码查询-化学品基本信息
  300. async chemicalAppletSelectStockInfo(code) {
  301. const {
  302. data
  303. } = await chemicalAppletSelectStockInfo({tagCode:code});
  304. if (data.code == 200) {
  305. if(data.data){
  306. data.data.code = code;
  307. //化学品信息
  308. uni.navigateTo({
  309. url: "/pages_basics/views/chemicalsInfo/chemicalsInfo?item=" + encodeURIComponent(JSON.stringify(data.data)),
  310. });
  311. }else{
  312. uni.showToast({
  313. mask: true,
  314. icon: "none",
  315. position: "center",
  316. title: '未找到相关信息,请扫描正确的二维码',
  317. duration: 2000
  318. });
  319. }
  320. }
  321. },
  322. //查询是否是同位素实验并且有签退
  323. async laboratorySubPassOutIsotopeSubSign(subId,result) {
  324. const {
  325. data
  326. } = await laboratorySubPassOutIsotopeSubSign({subId:subId});
  327. if (data.code == 200) {
  328. if(data.data.isotope){
  329. let obj = {
  330. subId:subId,
  331. subName:data.data.subName,
  332. passOutId:data.data.passOutId,
  333. }
  334. uni.navigateTo({
  335. url: "/pages_basics/views/photoInspection?item=" + encodeURIComponent(JSON.stringify(obj)),
  336. });
  337. }else{
  338. uni.reLaunch({
  339. url: '/pages/views/saoCode/saoCode?q=' + encodeURIComponent(result)
  340. });
  341. }
  342. }
  343. },
  344. }
  345. }
  346. </script>
  347. <style lang="stylus" scoped>
  348. @import '@/api/request/imagesUrl.styl';
  349. .pupilHome {
  350. height: 100%;
  351. flex: 1;
  352. display: flex;
  353. flex-direction: column;
  354. overflow-y: scroll;
  355. overflow-x: hidden;
  356. padding-bottom: 200rpx;
  357. .top-page-title {
  358. text-align: center;
  359. font-size: 28rpx;
  360. background-color: #0183FA;
  361. color: #fff;
  362. }
  363. .top-back-img {
  364. position: absolute;
  365. top: 0;
  366. left: 0;
  367. width: 750rpx;
  368. height: 539rpx;
  369. background: url($imagesUrl+'home/img_sy_bg@1x.png') no-repeat;
  370. background-size:100%;
  371. background-repeat: no-repeat;
  372. .position-img {
  373. z-index: 5;
  374. position: absolute;
  375. left: 0;
  376. top: 10rpx;
  377. width: 400rpx;
  378. height: 88rpx;
  379. }
  380. .position-data-button {
  381. z-index: 5;
  382. position: absolute;
  383. right: 0;
  384. top: 40rpx;
  385. width: 160rpx;
  386. height: 50rpx;
  387. line-height: 50rpx;
  388. background-color: #0183fa;
  389. color: #fff;
  390. font-size: 28rpx;
  391. text-align: center;
  392. border-top-left-radius: 30rpx;
  393. border-bottom-left-radius: 30rpx;
  394. }
  395. }
  396. .button-one-box {
  397. z-index: 5;
  398. background: #fff;
  399. width: 690rpx;
  400. border-radius: 20rpx;
  401. padding: 13px 0 20px;
  402. overflow: hidden;
  403. margin: 330rpx 30rpx 0;
  404. .button-min {
  405. display: inline-block;
  406. overflow: hidden;
  407. width: 172rpx;
  408. height: 123rpx;
  409. margin-top: 23rpx;
  410. .button-img {
  411. display: block;
  412. width: 80rpx;
  413. height: 80rpx;
  414. margin: 0 auto;
  415. }
  416. .button-name {
  417. margin-top: 15rpx;
  418. height: 28rpx;
  419. line-height: 28rpx;
  420. font-size: 28rpx;
  421. text-align: center;
  422. color: #333;
  423. }
  424. }
  425. }
  426. .button-two-box {
  427. z-index: 5;
  428. width: 690rpx;
  429. height: 120rpx;
  430. display: flex;
  431. margin: 0 30rpx 0;
  432. .button-big-box {
  433. width: 335rpx;
  434. display: flex;
  435. border-radius: 20rpx;
  436. img {
  437. display: block;
  438. margin: 20rpx 25rpx 0 25rpx;
  439. height: 80rpx;
  440. width: 80rpx;
  441. }
  442. .button-min-box {
  443. view:nth-child(1) {
  444. line-height: 32rpx;
  445. height: 32rpx;
  446. font-size: 30rpx;
  447. color: #333;
  448. margin: 20rpx 0 18rpx;
  449. }
  450. view:nth-child(2) {
  451. line-height: 28rpx;
  452. height: 28rpx;
  453. font-size: 26rpx;
  454. color: #999;
  455. }
  456. }
  457. }
  458. }
  459. .button-three-box {
  460. z-index: 5;
  461. width: 690rpx;
  462. height: 150rpx;
  463. margin: 20rpx 30rpx 0;
  464. .button-big-box-1{
  465. background: #CDE7FF;
  466. .button-min-box{
  467. view:nth-child(1){
  468. color: #0183FA;
  469. }
  470. view:nth-child(2){
  471. color: #666666;
  472. }
  473. }
  474. }
  475. .button-big-box {
  476. height:130rpx;
  477. border-radius: 20rpx;
  478. display: flex;
  479. img {
  480. display: block;
  481. width: 134rpx;
  482. height: 104rpx;
  483. margin: 23rpx 34rpx 0 30rpx;
  484. }
  485. .button-min-box {
  486. view:nth-child(1) {
  487. line-height: 30rpx;
  488. height: 30rpx;
  489. font-size: 30rpx;
  490. margin: 30rpx 0 15rpx;
  491. }
  492. view:nth-child(2) {
  493. line-height: 26rpx;
  494. height: 26rpx;
  495. font-size: 26rpx;
  496. }
  497. }
  498. }
  499. }
  500. .scan_btn {
  501. z-index: 10;
  502. position: fixed;
  503. bottom: 210rpx;
  504. right: 0rpx;
  505. width: 140rpx;
  506. height: 140rpx;
  507. }
  508. }
  509. </style>