pupilHome.vue 8.1 KB

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