pupilHome.vue 13 KB

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