pupilHome.vue 9.4 KB

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