pupilHome.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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()">
  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. } else if (type == 'securityAdmittancePupil') {
  111. //安全准入
  112. uni.navigateTo({
  113. url: "/pages_student/views/accessApplication/safeAccess",
  114. });
  115. } else if (type == 'securityCheck') {
  116. //安全检查
  117. uni.navigateTo({
  118. url: "/pages_safetyCheck/views/safetyCheck",
  119. });
  120. } else if (type == 'chemicalsPupil') {
  121. //化学品
  122. } else if (type == 'cageSiteSubscribePupil') {
  123. //笼位预约
  124. } else if (type == 'snapshotPupil') {
  125. //随手拍
  126. uni.navigateTo({
  127. url: "/pages_safetyExamine/views/snapshotManage/snapshotAdd",
  128. });
  129. } else if (type == 'leaveCheckPupil') {
  130. //离开检查
  131. uni.navigateTo({
  132. url: "/pages_basics/views/photoInspection",
  133. });
  134. } else if (type == 'violationRecordPupil') {
  135. //违规记录
  136. uni.navigateTo({
  137. url: "/pages_student/views/meViolation/meViolation",
  138. });
  139. }
  140. },
  141. /* 扫一扫*/
  142. saoCode() {
  143. let self = this;
  144. uni.scanCode({
  145. onlyFromCamera: true,
  146. success: function(res) {
  147. let list = res.result.split("?")[1].split("&");
  148. let codeData = {};
  149. list.forEach((item) => {
  150. codeData[item.split("=")[0]] = item.split("=")[1];
  151. })
  152. if (codeData.type == 1 || codeData.type == 2 || codeData.type == 3 || codeData.type ==
  153. 5 || codeData.type == 7 ||
  154. codeData.type == 8 || codeData.type == 9 || codeData.type == 10 ||
  155. codeData.type == 11 || codeData.type == 12) {
  156. uni.navigateTo({
  157. url: '/pages/views/saoCode/saoCode?q=' + encodeURIComponent(res.result)
  158. });
  159. } else {
  160. uni.showToast({
  161. mask: true,
  162. icon: "none",
  163. position: "center",
  164. title: '请扫描正确的小程序二维码',
  165. duration: 2000
  166. });
  167. }
  168. }
  169. });
  170. },
  171. }
  172. }
  173. </script>
  174. <style lang="stylus" scoped>
  175. .pupilHome {
  176. height: 100%;
  177. flex: 1;
  178. display: flex;
  179. flex-direction: column;
  180. overflow-y: scroll;
  181. overflow-x: hidden;
  182. padding-bottom: 200rpx;
  183. .top-page-title {
  184. text-align: center;
  185. font-size: 28rpx;
  186. background-color: #0183FA;
  187. color: #fff;
  188. }
  189. .top-back-img {
  190. position: absolute;
  191. top: 0;
  192. left: 0;
  193. width: 750rpx;
  194. height: 539rpx;
  195. background: url("@/pages/images/newImage/img_sy_bg@1x.png");
  196. background-size 100%;
  197. background-repeat: no-repeat;
  198. .position-img {
  199. z-index: 5;
  200. position: absolute;
  201. left: 0;
  202. top: 10rpx;
  203. width: 400rpx;
  204. height: 88rpx;
  205. }
  206. .position-data-button {
  207. z-index: 5;
  208. position: absolute;
  209. right: 0;
  210. top: 40rpx;
  211. width: 160rpx;
  212. height: 50rpx;
  213. line-height: 50rpx;
  214. background-color: #0183fa;
  215. color: #fff;
  216. font-size: 28rpx;
  217. text-align: center;
  218. border-top-left-radius: 30rpx;
  219. border-bottom-left-radius: 30rpx;
  220. }
  221. }
  222. .button-one-box {
  223. z-index: 5;
  224. background: #fff;
  225. width: 690rpx;
  226. border-radius: 20rpx;
  227. padding: 13px 0 20px;
  228. overflow: hidden;
  229. margin: 330rpx 30rpx 0;
  230. .button-min {
  231. display: inline-block;
  232. overflow: hidden;
  233. width: 172rpx;
  234. height: 123rpx;
  235. margin-top: 23rpx;
  236. .button-img {
  237. display: block;
  238. width: 80rpx;
  239. height: 80rpx;
  240. margin: 0 auto;
  241. }
  242. .button-name {
  243. margin-top: 15rpx;
  244. height: 28rpx;
  245. line-height: 28rpx;
  246. font-size: 28rpx;
  247. text-align: center;
  248. color: #333;
  249. }
  250. }
  251. }
  252. .button-two-box {
  253. z-index: 5;
  254. width: 690rpx;
  255. height: 120rpx;
  256. display: flex;
  257. margin: 20rpx 30rpx 0;
  258. .button-big-box {
  259. width: 335rpx;
  260. display: flex;
  261. border-radius: 20rpx;
  262. img {
  263. display: block;
  264. margin: 20rpx 31rpx 0 36rpx;
  265. height: 80rpx;
  266. width: 80rpx;
  267. }
  268. .button-min-box {
  269. view:nth-child(1) {
  270. line-height: 32rpx;
  271. height: 32rpx;
  272. font-size: 32rpx;
  273. color: #333;
  274. margin: 20rpx 0 18rpx;
  275. }
  276. view:nth-child(2) {
  277. line-height: 28rpx;
  278. height: 28rpx;
  279. font-size: 28rpx;
  280. color: #999;
  281. }
  282. }
  283. }
  284. }
  285. .button-three-box {
  286. z-index: 5;
  287. width: 690rpx;
  288. height: 150rpx;
  289. margin: 20rpx 30rpx 0;
  290. .button-big-box {
  291. border-radius: 20rpx;
  292. background-color: #FFF0DD;
  293. display: flex;
  294. img {
  295. display: block;
  296. width: 134rpx;
  297. height: 104rpx;
  298. margin: 23rpx 34rpx 0 30rpx;
  299. }
  300. .button-min-box {
  301. view:nth-child(1) {
  302. line-height: 30rpx;
  303. height: 30rpx;
  304. font-size: 30rpx;
  305. color: #FF8C00;
  306. margin: 27rpx 0 15rpx;
  307. }
  308. view:nth-child(2) {
  309. line-height: 26rpx;
  310. height: 26rpx;
  311. font-size: 26rpx;
  312. color: #666666;
  313. }
  314. }
  315. }
  316. }
  317. .scan_btn {
  318. z-index: 10;
  319. position: fixed;
  320. bottom: 210rpx;
  321. right: 0rpx;
  322. width: 140rpx;
  323. height: 140rpx;
  324. }
  325. }
  326. </style>