pupilHome.vue 13 KB

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