pupilHome.vue 14 KB

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