pupilHome.vue 9.0 KB

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