pupilHome.vue 8.5 KB

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