pupilHome.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  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 == 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. }else if(codeData.type == 9){
  179. self.chemicalAppletSelectStockInfo(codeData.code);
  180. }
  181. }else{
  182. self.chemicalAppletSelectStockInfo(res.result);
  183. }
  184. }
  185. });
  186. },
  187. //扫码查询-化学品基本信息
  188. async chemicalAppletSelectStockInfo(code) {
  189. const {
  190. data
  191. } = await chemicalAppletSelectStockInfo({tagCode:code});
  192. if (data.code == 200) {
  193. if(data.data){
  194. data.data.code = code;
  195. //化学品信息
  196. uni.navigateTo({
  197. url: "/pages_basics/views/chemicalsInfo/chemicalsInfo?item=" + encodeURIComponent(JSON.stringify(data.data)),
  198. });
  199. }else{
  200. uni.showToast({
  201. mask: true,
  202. icon: "none",
  203. position: "center",
  204. title: '未找到相关信息,请扫描正确的二维码',
  205. duration: 2000
  206. });
  207. }
  208. }
  209. },
  210. //查询是否是同位素实验并且有签退
  211. async laboratorySubPassOutIsotopeSubSign(subId,result) {
  212. const {
  213. data
  214. } = await laboratorySubPassOutIsotopeSubSign({subId:subId});
  215. if (data.code == 200) {
  216. if(data.data.isotope){
  217. let obj = {
  218. subId:subId,
  219. subName:data.data.subName,
  220. passOutId:data.data.passOutId,
  221. }
  222. uni.navigateTo({
  223. url: "/pages_basics/views/photoInspection?item=" + encodeURIComponent(JSON.stringify(obj)),
  224. });
  225. }else{
  226. uni.reLaunch({
  227. url: '/pages/views/saoCode/saoCode?q=' + encodeURIComponent(result)
  228. });
  229. }
  230. }
  231. },
  232. }
  233. }
  234. </script>
  235. <style lang="stylus" scoped>
  236. @import '@/api/request/imagesUrl.styl';
  237. .pupilHome {
  238. height: 100%;
  239. flex: 1;
  240. display: flex;
  241. flex-direction: column;
  242. overflow-y: scroll;
  243. overflow-x: hidden;
  244. padding-bottom: 200rpx;
  245. .top-page-title {
  246. text-align: center;
  247. font-size: 28rpx;
  248. background-color: #0183FA;
  249. color: #fff;
  250. }
  251. .top-back-img {
  252. position: absolute;
  253. top: 0;
  254. left: 0;
  255. width: 750rpx;
  256. height: 539rpx;
  257. background: url($imagesUrl+'home/img_sy_bg@1x.png') no-repeat;
  258. background-size:100%;
  259. background-repeat: no-repeat;
  260. .position-img {
  261. z-index: 5;
  262. position: absolute;
  263. left: 0;
  264. top: 10rpx;
  265. width: 400rpx;
  266. height: 88rpx;
  267. }
  268. .position-data-button {
  269. z-index: 5;
  270. position: absolute;
  271. right: 0;
  272. top: 40rpx;
  273. width: 160rpx;
  274. height: 50rpx;
  275. line-height: 50rpx;
  276. background-color: #0183fa;
  277. color: #fff;
  278. font-size: 28rpx;
  279. text-align: center;
  280. border-top-left-radius: 30rpx;
  281. border-bottom-left-radius: 30rpx;
  282. }
  283. }
  284. .button-one-box {
  285. z-index: 5;
  286. background: #fff;
  287. width: 690rpx;
  288. border-radius: 20rpx;
  289. padding: 13px 0 20px;
  290. overflow: hidden;
  291. margin: 330rpx 30rpx 0;
  292. .button-min {
  293. display: inline-block;
  294. overflow: hidden;
  295. width: 172rpx;
  296. height: 123rpx;
  297. margin-top: 23rpx;
  298. .button-img {
  299. display: block;
  300. width: 80rpx;
  301. height: 80rpx;
  302. margin: 0 auto;
  303. }
  304. .button-name {
  305. margin-top: 15rpx;
  306. height: 28rpx;
  307. line-height: 28rpx;
  308. font-size: 28rpx;
  309. text-align: center;
  310. color: #333;
  311. }
  312. }
  313. }
  314. .button-two-box {
  315. z-index: 5;
  316. width: 690rpx;
  317. height: 120rpx;
  318. display: flex;
  319. margin: 20rpx 30rpx 0;
  320. .button-big-box {
  321. width: 335rpx;
  322. display: flex;
  323. border-radius: 20rpx;
  324. img {
  325. display: block;
  326. margin: 20rpx 31rpx 0 36rpx;
  327. height: 80rpx;
  328. width: 80rpx;
  329. }
  330. .button-min-box {
  331. view:nth-child(1) {
  332. line-height: 32rpx;
  333. height: 32rpx;
  334. font-size: 32rpx;
  335. color: #333;
  336. margin: 20rpx 0 18rpx;
  337. }
  338. view:nth-child(2) {
  339. line-height: 28rpx;
  340. height: 28rpx;
  341. font-size: 28rpx;
  342. color: #999;
  343. }
  344. }
  345. }
  346. }
  347. .button-three-box {
  348. z-index: 5;
  349. width: 690rpx;
  350. height: 150rpx;
  351. margin: 20rpx 30rpx 0;
  352. .button-big-box {
  353. border-radius: 20rpx;
  354. background-color: #FFF0DD;
  355. display: flex;
  356. img {
  357. display: block;
  358. width: 134rpx;
  359. height: 104rpx;
  360. margin: 23rpx 34rpx 0 30rpx;
  361. }
  362. .button-min-box {
  363. view:nth-child(1) {
  364. line-height: 30rpx;
  365. height: 30rpx;
  366. font-size: 30rpx;
  367. color: #FF8C00;
  368. margin: 27rpx 0 15rpx;
  369. }
  370. view:nth-child(2) {
  371. line-height: 26rpx;
  372. height: 26rpx;
  373. font-size: 26rpx;
  374. color: #666666;
  375. }
  376. }
  377. }
  378. }
  379. .scan_btn {
  380. z-index: 10;
  381. position: fixed;
  382. bottom: 210rpx;
  383. right: 0rpx;
  384. width: 140rpx;
  385. height: 140rpx;
  386. }
  387. }
  388. </style>