pupilHome.vue 11 KB

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