pupilHome.vue 7.6 KB

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