pupilHome.vue 12 KB

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