pupilHome.vue 12 KB

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