pupilHome.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  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>
  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. codeData.type == 'offlineTraining') {
  269. uni.reLaunch({
  270. url: '/pages/views/saoCode/saoCode?q=' + encodeURIComponent(res.result)
  271. });
  272. }else if(codeData.type == 5){
  273. self.laboratorySubPassOutIsotopeSubSign(codeData.subId,res.result);
  274. }else if(codeData.type == 9){
  275. self.chemicalAppletSelectStockInfo(codeData.code);
  276. }
  277. }else{
  278. self.chemicalAppletSelectStockInfo(res.result);
  279. }
  280. }
  281. });
  282. },
  283. //扫码查询-化学品基本信息
  284. async chemicalAppletSelectStockInfo(code) {
  285. const {
  286. data
  287. } = await chemicalAppletSelectStockInfo({tagCode:code});
  288. if (data.code == 200) {
  289. if(data.data){
  290. data.data.code = code;
  291. //化学品信息
  292. uni.navigateTo({
  293. url: "/pages_basics/views/chemicalsInfo/chemicalsInfo?item=" + encodeURIComponent(JSON.stringify(data.data)),
  294. });
  295. }else{
  296. uni.showToast({
  297. mask: true,
  298. icon: "none",
  299. position: "center",
  300. title: '未找到相关信息,请扫描正确的二维码',
  301. duration: 2000
  302. });
  303. }
  304. }
  305. },
  306. //查询是否是同位素实验并且有签退
  307. async laboratorySubPassOutIsotopeSubSign(subId,result) {
  308. const {
  309. data
  310. } = await laboratorySubPassOutIsotopeSubSign({subId:subId});
  311. if (data.code == 200) {
  312. if(data.data.isotope){
  313. let obj = {
  314. subId:subId,
  315. subName:data.data.subName,
  316. passOutId:data.data.passOutId,
  317. }
  318. uni.navigateTo({
  319. url: "/pages_basics/views/photoInspection?item=" + encodeURIComponent(JSON.stringify(obj)),
  320. });
  321. }else{
  322. uni.reLaunch({
  323. url: '/pages/views/saoCode/saoCode?q=' + encodeURIComponent(result)
  324. });
  325. }
  326. }
  327. },
  328. }
  329. }
  330. </script>
  331. <style lang="stylus" scoped>
  332. @import '@/api/request/imagesUrl.styl';
  333. .pupilHome {
  334. height: 100%;
  335. flex: 1;
  336. display: flex;
  337. flex-direction: column;
  338. overflow-y: scroll;
  339. overflow-x: hidden;
  340. padding-bottom: 200rpx;
  341. .top-page-title {
  342. text-align: center;
  343. font-size: 28rpx;
  344. background-color: #0183FA;
  345. color: #fff;
  346. }
  347. .top-back-img {
  348. position: absolute;
  349. top: 0;
  350. left: 0;
  351. width: 750rpx;
  352. height: 539rpx;
  353. background: url($imagesUrl+'home/img_sy_bg@1x.png') no-repeat;
  354. background-size:100%;
  355. background-repeat: no-repeat;
  356. .position-img {
  357. z-index: 5;
  358. position: absolute;
  359. left: 0;
  360. top: 10rpx;
  361. width: 400rpx;
  362. height: 88rpx;
  363. }
  364. .position-data-button {
  365. z-index: 5;
  366. position: absolute;
  367. right: 0;
  368. top: 40rpx;
  369. width: 160rpx;
  370. height: 50rpx;
  371. line-height: 50rpx;
  372. background-color: #0183fa;
  373. color: #fff;
  374. font-size: 28rpx;
  375. text-align: center;
  376. border-top-left-radius: 30rpx;
  377. border-bottom-left-radius: 30rpx;
  378. }
  379. }
  380. .button-one-box {
  381. z-index: 5;
  382. background: #fff;
  383. width: 690rpx;
  384. border-radius: 20rpx;
  385. padding: 13px 0 20px;
  386. overflow: hidden;
  387. margin: 330rpx 30rpx 0;
  388. .button-min {
  389. display: inline-block;
  390. overflow: hidden;
  391. width: 172rpx;
  392. height: 123rpx;
  393. margin-top: 23rpx;
  394. .button-img {
  395. display: block;
  396. width: 80rpx;
  397. height: 80rpx;
  398. margin: 0 auto;
  399. }
  400. .button-name {
  401. margin-top: 15rpx;
  402. height: 28rpx;
  403. line-height: 28rpx;
  404. font-size: 28rpx;
  405. text-align: center;
  406. color: #333;
  407. }
  408. }
  409. }
  410. .button-two-box {
  411. z-index: 5;
  412. width: 690rpx;
  413. height: 120rpx;
  414. display: flex;
  415. margin: 0 30rpx 0;
  416. .button-big-box {
  417. width: 335rpx;
  418. display: flex;
  419. border-radius: 20rpx;
  420. img {
  421. display: block;
  422. margin: 20rpx 25rpx 0 25rpx;
  423. height: 80rpx;
  424. width: 80rpx;
  425. }
  426. .button-min-box {
  427. view:nth-child(1) {
  428. line-height: 32rpx;
  429. height: 32rpx;
  430. font-size: 30rpx;
  431. color: #333;
  432. margin: 20rpx 0 18rpx;
  433. }
  434. view:nth-child(2) {
  435. line-height: 28rpx;
  436. height: 28rpx;
  437. font-size: 26rpx;
  438. color: #999;
  439. }
  440. }
  441. }
  442. }
  443. .button-three-box {
  444. z-index: 5;
  445. width: 690rpx;
  446. height: 150rpx;
  447. margin: 20rpx 30rpx 0;
  448. .button-big-box-1{
  449. background: #CDE7FF;
  450. .button-min-box{
  451. view:nth-child(1){
  452. color: #0183FA;
  453. }
  454. view:nth-child(2){
  455. color: #666666;
  456. }
  457. }
  458. }
  459. .button-big-box {
  460. height:130rpx;
  461. border-radius: 20rpx;
  462. display: flex;
  463. img {
  464. display: block;
  465. width: 134rpx;
  466. height: 104rpx;
  467. margin: 23rpx 34rpx 0 30rpx;
  468. }
  469. .button-min-box {
  470. view:nth-child(1) {
  471. line-height: 30rpx;
  472. height: 30rpx;
  473. font-size: 30rpx;
  474. margin: 30rpx 0 15rpx;
  475. }
  476. view:nth-child(2) {
  477. line-height: 26rpx;
  478. height: 26rpx;
  479. font-size: 26rpx;
  480. }
  481. }
  482. }
  483. }
  484. .scan_btn {
  485. z-index: 10;
  486. position: fixed;
  487. bottom: 210rpx;
  488. right: 0rpx;
  489. width: 140rpx;
  490. height: 140rpx;
  491. }
  492. }
  493. </style>