pupilHome.vue 12 KB

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