studentWorkbench.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. <!-- 学生端工作台 -->
  2. <template>
  3. <view class="user-workbench" :style="{paddingTop:navHeight+'rpx'}">
  4. <nav-bar :title="title"></nav-bar>
  5. <img class="top-big-img" :src="homepageBanner">
  6. <view class="min-icon-button-box">
  7. <view @click="goPage('casuallyPat')">
  8. <img src="@/images/Version2.2/icon_sy_ssp.png">
  9. <view>随手拍</view>
  10. </view>
  11. <view @click="saoCode">
  12. <img src="@/images/Version2.2/btn_wd_jfdh.png">
  13. <view>积分兑换</view>
  14. </view>
  15. <view @click="goPage('safeAccess')">
  16. <img src="@/images/Version2.2/icon_sy_zrsq.png">
  17. <view>准入申请</view>
  18. </view>
  19. <view @click="goPage('safetyInspect')">
  20. <img src="@/images/Version2.2/icon_sy_aqjc.png">
  21. <view>安全检查</view>
  22. </view>
  23. <view @click="goPage('photoInspection')">
  24. <img src="@/images/icon_dzt_pzjc.png">
  25. <view>离开检查</view>
  26. </view>
  27. <view @click="goPage('gas')">
  28. <img src="@/images/Version3.0/icon_sy_qpgl.png">
  29. <view>气瓶管理</view>
  30. </view>
  31. <view @click="goPage('none')">
  32. <img src="@/images/Version3.0/icon_sy_hxp.png">
  33. <view>化学品管理</view>
  34. </view>
  35. <view @click="goPage('none')">
  36. <img src="@/images/Version3.0/icon_sy_tzsb.png">
  37. <view>特种设备</view>
  38. </view>
  39. </view>
  40. <!-- 分级管控 -->
  41. <view class="grading">
  42. <img class="grading_l" src="@/images/icon_sy_fjgk.png"/>
  43. <view class="grading_c">分级管控</view>
  44. <view class="grading_r" @click="goPage('grading')">{{gradingCount>0?gradingCount+'项工作待完成':''}}<img src="@/images/icon_wdwg_gd.png"/></view>
  45. </view>
  46. <view class="big-icon-button-box">
  47. <view class="left-box">
  48. <img class="left-top-img" @click="goNull" src="@/images/Version2.2/img_bg_cjcx.png">
  49. <img class="left-bottom-img" @click="goPage('meViolation')" src="@/images/Version2.2/img_bg_wgjl.png">
  50. </view>
  51. <img class="right-img" @click="goNull" src="@/images/Version2.2/img_bg_jfmx.png">
  52. </view>
  53. <view class="bottom-max-box">
  54. <view class="bottom-title">
  55. <img src="@/images/Version2.2/icon_sy_wdzs.png">
  56. <view>我的证书</view>
  57. </view>
  58. <view class="bottom-big-box">
  59. <view class="bottom-for-box" v-for="(item,index) in dataList" :key="index">
  60. <view class="bottom-top-box">{{item.certTitle}}</view>
  61. <view class="bottom-bottom-box">
  62. <view class="bottom-right-box">{{item.createTime}}获得</view>
  63. <view class="bottom-right-box">到期时间:{{item.expirationTime}}</view>
  64. </view>
  65. </view>
  66. <view class="null-view" v-if="!dataList[0]">暂无数据</view>
  67. </view>
  68. </view>
  69. <tab-bar></tab-bar>
  70. </view>
  71. </template>
  72. <script>
  73. import { myViolationCount,queryMyCert,outSubjectPhoto,gradingControl,getGentleIdentifier} from '@/api/basicsModules/index.js'
  74. import { tabBar } from '@/component/tabBar.vue'
  75. import { navBar } from '@/component/navbar.vue'
  76. export default {
  77. components: {
  78. tabBar,
  79. navBar
  80. },
  81. data() {
  82. return {
  83. navHeight: uni.getStorageSync('navHeight'),
  84. title:'实验室安全智能监测与控制系统',
  85. hintType:false,
  86. dataList:[],
  87. violationData:{},
  88. gradingCount:0,
  89. homepageBanner:uni.getStorageSync('homepageBanner'),
  90. }
  91. },
  92. created() {
  93. },
  94. mounted(){
  95. this.myViolationCount();
  96. this.getGrading();
  97. this.queryMyCert();
  98. },
  99. methods: {
  100. //获取分级管控未完成总数
  101. async getGrading(){
  102. let obj = {
  103. }
  104. const {data} = await gradingControl(obj)
  105. if(data.code==200){
  106. this.gradingCount=data.count;
  107. }
  108. },
  109. //暂无提示
  110. goNull(){
  111. uni.showToast({
  112. title: '暂未开放',
  113. mask:true,
  114. icon:"none",
  115. duration: 2000
  116. });
  117. },
  118. //调用摄像头
  119. saoCode(){
  120. uni.scanCode({
  121. onlyFromCamera: true,
  122. success: function (res) {
  123. uni.navigateTo({
  124. url: '/pages_student/mine/codeSuccess?q='+encodeURIComponent(JSON.stringify(res.result))
  125. });
  126. }
  127. });
  128. },
  129. // 查询违规记录列表 (用户端)
  130. async myViolationCount(){
  131. let self = this;
  132. let {data} = await myViolationCount()
  133. if(data.code == 200){
  134. this.violationData = data.data;
  135. }
  136. },
  137. // 查询证书列表 (用户端)
  138. async queryMyCert(){
  139. let self = this;
  140. let {data} = await queryMyCert({})
  141. if(data.code == 200){
  142. let list = [];
  143. for(let i=0;i<data.rows.length;i++){
  144. let timeOne = (new Date(data.rows[i].createTime)).getTime();
  145. let timeTwo = (new Date(data.rows[i].expirationTime)).getTime();
  146. data.rows[i].createTime = self.formatDate(timeOne);
  147. data.rows[i].expirationTime = self.formatDate(timeTwo);
  148. }
  149. this.dataList = data.rows;
  150. }
  151. },
  152. formatDate(date) {
  153. let newDate = new Date(date);
  154. let YY = newDate.getFullYear() + '-';
  155. let MM = (newDate.getMonth() + 1 < 10 ? '0' + (newDate.getMonth() + 1) : newDate.getMonth() + 1) + '-';
  156. let DD = (newDate.getDate() < 10 ? '0' + (newDate.getDate()) : newDate.getDate());
  157. return YY + MM + DD;
  158. },
  159. //页面跳转
  160. goPage(type){
  161. if(type == 'meViolation'){//我的违规
  162. uni.navigateTo({
  163. url: '/pages_student/workbench/meViolation',
  164. });
  165. }else if(type == 'photoInspection'){//离开检查
  166. this.outSubjectPhoto();
  167. }else if(type == 'resultInquiry'){//成绩查询
  168. uni.navigateTo({
  169. url: '/pages_student/workbench/resultInquiry',
  170. });
  171. }else if(type == 'casuallyPat'){//随手拍
  172. uni.navigateTo({
  173. url: '/pages/casuallyPat',//随手拍
  174. });
  175. }else if(type == 'safeAccess'){//安全准入
  176. uni.navigateTo({
  177. url: '/pages_student/workbench/safeAccess/safeAccess',
  178. });
  179. }else if(type == 'examList'){//在线考试
  180. uni.navigateTo({
  181. url: '/pages_student/workbench/exam/examList',
  182. });
  183. }else if(type == 'grading'){
  184. uni.navigateTo({
  185. url: '/pages_student/gradingControl/gradingControl',//分级管控
  186. });
  187. }else if(type == 'safetyInspect'){//安全检查
  188. this.getGentleIdentifier();
  189. // uni.navigateTo({
  190. // url: '/pages_manage/workbench/problemRectification/rectifyList',//安全检查
  191. // });
  192. }else if(type == 'gas'){//气瓶管理
  193. uni.navigateTo({
  194. url: '/pages_student/gasManage/gasManage',
  195. });
  196. }else if(type == 'none'){
  197. uni.showToast({
  198. title: '暂未开放',
  199. icon:"none",
  200. mask:true,
  201. duration: 2000
  202. });
  203. }
  204. },
  205. //获取拍照检查配置
  206. async outSubjectPhoto(){
  207. const {data} = await outSubjectPhoto();
  208. if(data.code == 200){
  209. if(data.data == null){
  210. //需要检查(重新填写)
  211. let obj = {
  212. sub:"实验室照片",
  213. subUrl:"",
  214. garbage:"垃圾桶清理后照片",
  215. garbageUrl:"",
  216. dangerous:"使用危险设备照片(选填)",
  217. dangerousUrl:"",
  218. sourceRisk:"危险源设备使用登记本照片(选填)",
  219. sourceRiskUrl:"",
  220. };
  221. uni.navigateTo({
  222. url: '/pages_student/workbench/photoInspection?newData='+encodeURIComponent(JSON.stringify(obj)),
  223. });
  224. }else if(data.data == false){
  225. //不需要检查
  226. uni.showToast({
  227. title: '暂无检查数据',
  228. icon:"none",
  229. mask:true,
  230. duration: 2000
  231. });
  232. }else{
  233. //需要检查(修改内容)
  234. let obj = {
  235. id:data.data.id,
  236. sub:"实验室照片",
  237. subUrl:data.data.subUrl,
  238. garbage:"垃圾桶清理后照片",
  239. garbageUrl:data.data.garbageUrl,
  240. dangerous:"使用危险设备照片(选填)",
  241. dangerousUrl:data.data.dangerousUrl,
  242. sourceRisk:"危险源设备使用登记本照片(选填)",
  243. sourceRiskUrl:data.data.sourceRiskUrl,
  244. };
  245. uni.navigateTo({
  246. url: '/pages_student/workbench/photoInspection?newData='+encodeURIComponent(JSON.stringify(obj)),
  247. });
  248. }
  249. }
  250. },
  251. //获取用户身份标识"adminGentle": false, 管理员身份 "rectifyGentle": false, 整改身份"applyGentle": false 检查者身份
  252. async getGentleIdentifier(){
  253. let self = this;
  254. const {data} = await getGentleIdentifier();
  255. if(data.code==200){
  256. let pageType = null
  257. // 如果是管理员 检查者和整改者
  258. if(data.data.adminGentle && (data.data.applyGentle || data.data.myApplyGentle) && data.data.rectifyGentle){
  259. pageType=1
  260. }else if(data.data.adminGentle && (data.data.applyGentle || data.data.myApplyGentle) && !data.data.rectifyGentle){
  261. pageType=1
  262. }else if(data.data.adminGentle && !data.data.applyGentle && data.data.rectifyGentle){
  263. pageType=1
  264. }else if(!data.data.adminGentle && (data.data.applyGentle || data.data.myApplyGentle) && data.data.rectifyGentle){
  265. pageType=2
  266. }else if(data.data.adminGentle && !data.data.applyGentle && !data.data.rectifyGentle){
  267. pageType=1
  268. }else if(!data.data.adminGentle && (data.data.applyGentle || data.data.myApplyGentle) && !data.data.rectifyGentle){
  269. pageType=2
  270. }else if(!data.data.adminGentle && !data.data.applyGentle && data.data.rectifyGentle){
  271. pageType=3
  272. }
  273. uni.setStorageSync('gentleIdentifier',pageType)
  274. uni.setStorageSync('gentleIdentifierData',data.data)
  275. if(pageType){
  276. uni.navigateTo({
  277. url: '/pages/safetyExamineWorkbench',
  278. });
  279. }else{
  280. uni.showToast({
  281. title: '没有相关权限',
  282. icon:"none",
  283. mask:true,
  284. duration: 2000
  285. });
  286. }
  287. }
  288. },
  289. }
  290. }
  291. </script>
  292. <style lang="stylus" scoped>
  293. .user-workbench{
  294. height:100%;
  295. flex:1;
  296. box-sizing: border-box;
  297. .top-big-img{
  298. height:342rpx;
  299. width:750rpx;
  300. background :#ffffff;
  301. }
  302. .min-icon-button-box{
  303. display flex;
  304. justify-content: flex-start;
  305. flex-wrap: wrap;
  306. width:710rpx;
  307. margin:20rpx;
  308. background :#ffffff;
  309. border-radius:20rpx;
  310. padding-bottom: 20rpx;
  311. view{
  312. width: 176rpx;
  313. img{
  314. height:75rpx;
  315. width:75rpx;
  316. margin:30rpx auto 10rpx;
  317. }
  318. view{
  319. text-align center
  320. font-size:24rpx;
  321. }
  322. }
  323. }
  324. /* 分级管控 */
  325. .grading{
  326. width :712rpx;
  327. height :80rpx;
  328. background: #FFFFFF;
  329. border-radius: 20rpx;
  330. margin-left:20rpx;
  331. margin-bottom :20rpx;
  332. display:flex;
  333. justify-content :flex-start;
  334. align-items :center;
  335. .grading_l{
  336. width :34rpx;
  337. height :34rpx;
  338. margin-left:16rpx;
  339. }
  340. .grading_c{
  341. font-size: 28rpx;
  342. font-family: PingFang SC;
  343. font-weight: 500;
  344. color: #333333;
  345. margin-left:16rpx;
  346. }
  347. .grading_r{
  348. width :504rpx;
  349. height :80rpx;
  350. font-size: 26rpx;
  351. font-family: PingFang SC;
  352. font-weight: 500;
  353. color: #EE3A3A;
  354. display :flex;
  355. justify-content :flex-end;
  356. align-items: center;
  357. >img{
  358. width: 20rpx;
  359. height: 20rpx;
  360. margin-left :20rpx;
  361. margin-top :8rpx;
  362. }
  363. }
  364. }
  365. .big-icon-button-box{
  366. width:710rpx;
  367. height:354rpx;
  368. margin:0 20rpx 20rpx;
  369. background :#ffffff;
  370. border-radius:20rpx;
  371. display flex
  372. .left-box{
  373. width:310rpx;
  374. height:310rpx;
  375. margin:22rpx 10rpx 22rpx 15rpx;
  376. .left-top-img{
  377. width:310rpx;
  378. height:150rpx;
  379. margin-bottom:14rpx;
  380. }
  381. .left-bottom-img{
  382. width:310rpx;
  383. height:150rpx;
  384. }
  385. }
  386. .right-img{
  387. width:362rpx;
  388. height:310rpx;
  389. margin:22rpx 13rpx 22rpx 0;
  390. }
  391. }
  392. .top-max-box{
  393. height:119rpx;
  394. background #fff
  395. overflow hidden
  396. .top-big-box{
  397. height:60rpx;
  398. width:649rpx;
  399. background: #F5F5F5;
  400. border-radius: 30px;
  401. margin:30rpx auto;
  402. padding:0 30rpx;
  403. }
  404. .top-big-one-type{
  405. color:#F95F5F;
  406. line-height:60rpx;
  407. font-size: 26rpx;
  408. }
  409. .top-big-two-type{
  410. line-height:60rpx;
  411. font-size: 26rpx;
  412. display flex
  413. .left-view{
  414. flex:1;
  415. display flex
  416. color:#333;
  417. .left-min-view{
  418. color:#e45656;
  419. }
  420. }
  421. .left-button-view{
  422. color:#0183fa;
  423. }
  424. }
  425. }
  426. .button-max-box{
  427. /*height:446rpx;*/
  428. background #fff
  429. margin-bottom:20rpx;
  430. .button-title{
  431. line-height:100rpx;
  432. border-bottom:1rpx solid #E0E0E0;
  433. padding-left:20rpx;
  434. }
  435. .button-max-box{
  436. /*height:345rpx;*/
  437. .button-min-box{
  438. width:250rpx;
  439. height:172rpx;
  440. display inline-block
  441. img{
  442. width:80rpx;
  443. height:80rpx;
  444. margin:34rpx auto 0;
  445. }
  446. view{
  447. line-height:50rpx;
  448. text-align center;
  449. font-size:28rpx;
  450. color: #333;
  451. }
  452. }
  453. }
  454. }
  455. .bottom-max-box{
  456. flex:1;
  457. background #fff
  458. margin:0 20rpx 100rpx;
  459. border-radius:20rpx;
  460. display flex
  461. flex-direction column
  462. overflow-y hidden
  463. .bottom-title{
  464. display flex
  465. border-bottom:1rpx solid #E0E0E0;
  466. img{
  467. width:34rpx;
  468. height:34rpx;
  469. margin:35rpx 16rpx 0 10rpx;
  470. }
  471. view{
  472. line-height:100rpx;
  473. }
  474. }
  475. .bottom-big-box{
  476. flex:1;
  477. overflow-y scroll
  478. .bottom-for-box:nth-child(1){
  479. border:none;
  480. }
  481. .bottom-for-box{
  482. height:154rpx;
  483. margin:0 20rpx;
  484. border-top:1rpx solid #E0E0E0;
  485. overflow hidden
  486. .bottom-top-box{
  487. font-size:28rpx;
  488. line-height:28rpx;
  489. color:#333;
  490. display:block;
  491. overflow:hidden;
  492. text-overflow:ellipsis;
  493. white-space:nowrap;
  494. margin:36rpx 0 30rpx;
  495. }
  496. .bottom-bottom-box{
  497. display flex
  498. view{
  499. flex:1;
  500. line-height:48rpx;
  501. font-size: 28rpx;
  502. color: #999999;
  503. display:block;
  504. overflow:hidden;
  505. text-overflow:ellipsis;
  506. white-space:nowrap;
  507. }
  508. view:nth-child(2){
  509. text-align right
  510. }
  511. }
  512. }
  513. .null-view{
  514. text-align center;
  515. color:#999;
  516. line-height:80rpx;
  517. font-size:28rpx;
  518. }
  519. }
  520. }
  521. }
  522. </style>