pupilHome.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  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="@/pages/images/newImage/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="@/pages/images/newImage/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="@/pages/images/newImage/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="@/pages/images/newImage/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="@/pages/images/newImage/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="@/pages/images/newImage/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="@/pages/images/newImage/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="@/pages/images/newImage/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="@/pages/images/newImage/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="@/pages/images/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) {
  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. .pupilHome {
  188. height: 100%;
  189. flex: 1;
  190. display: flex;
  191. flex-direction: column;
  192. overflow-y: scroll;
  193. overflow-x: hidden;
  194. padding-bottom: 200rpx;
  195. .top-page-title {
  196. text-align: center;
  197. font-size: 28rpx;
  198. background-color: #0183FA;
  199. color: #fff;
  200. }
  201. .top-back-img {
  202. position: absolute;
  203. top: 0;
  204. left: 0;
  205. width: 750rpx;
  206. height: 539rpx;
  207. background: url("@/pages/images/newImage/img_sy_bg@1x.png");
  208. background-size 100%;
  209. background-repeat: no-repeat;
  210. .position-img {
  211. z-index: 5;
  212. position: absolute;
  213. left: 0;
  214. top: 10rpx;
  215. width: 400rpx;
  216. height: 88rpx;
  217. }
  218. .position-data-button {
  219. z-index: 5;
  220. position: absolute;
  221. right: 0;
  222. top: 40rpx;
  223. width: 160rpx;
  224. height: 50rpx;
  225. line-height: 50rpx;
  226. background-color: #0183fa;
  227. color: #fff;
  228. font-size: 28rpx;
  229. text-align: center;
  230. border-top-left-radius: 30rpx;
  231. border-bottom-left-radius: 30rpx;
  232. }
  233. }
  234. .button-one-box {
  235. z-index: 5;
  236. background: #fff;
  237. width: 690rpx;
  238. border-radius: 20rpx;
  239. padding: 13px 0 20px;
  240. overflow: hidden;
  241. margin: 330rpx 30rpx 0;
  242. .button-min {
  243. display: inline-block;
  244. overflow: hidden;
  245. width: 172rpx;
  246. height: 123rpx;
  247. margin-top: 23rpx;
  248. .button-img {
  249. display: block;
  250. width: 80rpx;
  251. height: 80rpx;
  252. margin: 0 auto;
  253. }
  254. .button-name {
  255. margin-top: 15rpx;
  256. height: 28rpx;
  257. line-height: 28rpx;
  258. font-size: 28rpx;
  259. text-align: center;
  260. color: #333;
  261. }
  262. }
  263. }
  264. .button-two-box {
  265. z-index: 5;
  266. width: 690rpx;
  267. height: 120rpx;
  268. display: flex;
  269. margin: 20rpx 30rpx 0;
  270. .button-big-box {
  271. width: 335rpx;
  272. display: flex;
  273. border-radius: 20rpx;
  274. img {
  275. display: block;
  276. margin: 20rpx 31rpx 0 36rpx;
  277. height: 80rpx;
  278. width: 80rpx;
  279. }
  280. .button-min-box {
  281. view:nth-child(1) {
  282. line-height: 32rpx;
  283. height: 32rpx;
  284. font-size: 32rpx;
  285. color: #333;
  286. margin: 20rpx 0 18rpx;
  287. }
  288. view:nth-child(2) {
  289. line-height: 28rpx;
  290. height: 28rpx;
  291. font-size: 28rpx;
  292. color: #999;
  293. }
  294. }
  295. }
  296. }
  297. .button-three-box {
  298. z-index: 5;
  299. width: 690rpx;
  300. height: 150rpx;
  301. margin: 20rpx 30rpx 0;
  302. .button-big-box {
  303. border-radius: 20rpx;
  304. background-color: #FFF0DD;
  305. display: flex;
  306. img {
  307. display: block;
  308. width: 134rpx;
  309. height: 104rpx;
  310. margin: 23rpx 34rpx 0 30rpx;
  311. }
  312. .button-min-box {
  313. view:nth-child(1) {
  314. line-height: 30rpx;
  315. height: 30rpx;
  316. font-size: 30rpx;
  317. color: #FF8C00;
  318. margin: 27rpx 0 15rpx;
  319. }
  320. view:nth-child(2) {
  321. line-height: 26rpx;
  322. height: 26rpx;
  323. font-size: 26rpx;
  324. color: #666666;
  325. }
  326. }
  327. }
  328. }
  329. .scan_btn {
  330. z-index: 10;
  331. position: fixed;
  332. bottom: 210rpx;
  333. right: 0rpx;
  334. width: 140rpx;
  335. height: 140rpx;
  336. }
  337. }
  338. </style>