pupilHome.vue 9.9 KB

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