pupilHome.vue 7.6 KB

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