studentWorkbench.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  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,getDicts} from '@/api/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.gasBottleSpecificationFun();
  98. this.gasBottleLevelFun();
  99. this.queryMyCert();
  100. },
  101. methods: {
  102. //获取分级管控未完成总数
  103. async getGrading(){
  104. let obj = {
  105. }
  106. const {data} = await gradingControl(obj)
  107. if(data.code==200){
  108. this.gradingCount=data.count;
  109. }
  110. },
  111. //暂无提示
  112. goNull(){
  113. uni.showToast({
  114. title: '暂未开放',
  115. mask:true,
  116. icon:"none",
  117. duration: 2000
  118. });
  119. },
  120. //气瓶规格
  121. async gasBottleSpecificationFun(){
  122. const {data} = await getDicts('gasBottleSpecification');
  123. if(data.code == 200){
  124. uni.setStorageSync('gasBottleSpecification', data.data)
  125. }
  126. },
  127. //气瓶级别
  128. async gasBottleLevelFun(){
  129. const {data} = await getDicts('gasBottleLevel');
  130. if(data.code == 200){
  131. uni.setStorageSync('gasBottleLevel', data.data)
  132. }
  133. },
  134. //调用摄像头
  135. saoCode(){
  136. uni.scanCode({
  137. onlyFromCamera: true,
  138. success: function (res) {
  139. uni.navigateTo({
  140. url: '/pages_student/mine/codeSuccess?q='+encodeURIComponent(JSON.stringify(res.result))
  141. });
  142. }
  143. });
  144. },
  145. // 查询违规记录列表 (用户端)
  146. async myViolationCount(){
  147. let self = this;
  148. let {data} = await myViolationCount()
  149. if(data.code == 200){
  150. this.violationData = data.data;
  151. }
  152. },
  153. // 查询证书列表 (用户端)
  154. async queryMyCert(){
  155. let self = this;
  156. let {data} = await queryMyCert({})
  157. if(data.code == 200){
  158. let list = [];
  159. for(let i=0;i<data.rows.length;i++){
  160. let timeOne = (new Date(data.rows[i].createTime)).getTime();
  161. let timeTwo = (new Date(data.rows[i].expirationTime)).getTime();
  162. data.rows[i].createTime = self.formatDate(timeOne);
  163. data.rows[i].expirationTime = self.formatDate(timeTwo);
  164. }
  165. this.dataList = data.rows;
  166. }
  167. },
  168. formatDate(date) {
  169. let newDate = new Date(date);
  170. let YY = newDate.getFullYear() + '-';
  171. let MM = (newDate.getMonth() + 1 < 10 ? '0' + (newDate.getMonth() + 1) : newDate.getMonth() + 1) + '-';
  172. let DD = (newDate.getDate() < 10 ? '0' + (newDate.getDate()) : newDate.getDate());
  173. return YY + MM + DD;
  174. },
  175. //页面跳转
  176. goPage(type){
  177. if(type == 'meViolation'){//我的违规
  178. uni.navigateTo({
  179. url: '/pages_student/workbench/meViolation',
  180. });
  181. }else if(type == 'photoInspection'){//离开检查
  182. this.outSubjectPhoto();
  183. }else if(type == 'resultInquiry'){//成绩查询
  184. uni.navigateTo({
  185. url: '/pages_student/workbench/resultInquiry',
  186. });
  187. }else if(type == 'casuallyPat'){//随手拍
  188. uni.navigateTo({
  189. url: '/pages/casuallyPat',//随手拍
  190. });
  191. }else if(type == 'safeAccess'){//安全准入
  192. uni.navigateTo({
  193. url: '/pages_student/workbench/safeAccess/safeAccess',
  194. });
  195. }else if(type == 'examList'){//在线考试
  196. uni.navigateTo({
  197. url: '/pages_student/workbench/exam/examList',
  198. });
  199. }else if(type == 'grading'){
  200. uni.navigateTo({
  201. url: '/pages_student/gradingControl/gradingControl',//分级管控
  202. });
  203. }else if(type == 'safetyInspect'){//安全检查
  204. uni.navigateTo({
  205. url: '/pages_manage/workbench/problemRectification/rectifyList',//安全检查
  206. });
  207. }else if(type == 'gas'){//气瓶管理
  208. uni.navigateTo({
  209. url: '/pages/gasBottle/gasManage/gasManage',
  210. });
  211. }else if(type == 'none'){
  212. uni.showToast({
  213. title: '暂未开放',
  214. icon:"none",
  215. mask:true,
  216. duration: 2000
  217. });
  218. }
  219. },
  220. //获取拍照检查配置
  221. async outSubjectPhoto(){
  222. const {data} = await outSubjectPhoto();
  223. if(data.code == 200){
  224. if(data.data == null){
  225. //需要检查(重新填写)
  226. let obj = {
  227. sub:"实验室照片",
  228. subUrl:"",
  229. garbage:"垃圾桶清理后照片",
  230. garbageUrl:"",
  231. dangerous:"使用危险设备照片(选填)",
  232. dangerousUrl:"",
  233. sourceRisk:"危险源设备使用登记本照片(选填)",
  234. sourceRiskUrl:"",
  235. };
  236. uni.navigateTo({
  237. url: '/pages_student/workbench/photoInspection?newData='+encodeURIComponent(JSON.stringify(obj)),
  238. });
  239. }else if(data.data == false){
  240. //不需要检查
  241. uni.showToast({
  242. title: '暂无检查数据',
  243. icon:"none",
  244. mask:true,
  245. duration: 2000
  246. });
  247. }else{
  248. //需要检查(修改内容)
  249. let obj = {
  250. id:data.data.id,
  251. sub:"实验室照片",
  252. subUrl:data.data.subUrl,
  253. garbage:"垃圾桶清理后照片",
  254. garbageUrl:data.data.garbageUrl,
  255. dangerous:"使用危险设备照片(选填)",
  256. dangerousUrl:data.data.dangerousUrl,
  257. sourceRisk:"危险源设备使用登记本照片(选填)",
  258. sourceRiskUrl:data.data.sourceRiskUrl,
  259. };
  260. uni.navigateTo({
  261. url: '/pages_student/workbench/photoInspection?newData='+encodeURIComponent(JSON.stringify(obj)),
  262. });
  263. }
  264. }
  265. },
  266. }
  267. }
  268. </script>
  269. <style lang="stylus" scoped>
  270. .user-workbench{
  271. height:100%;
  272. flex:1;
  273. box-sizing: border-box;
  274. .top-big-img{
  275. height:342rpx;
  276. width:750rpx;
  277. background :#ffffff;
  278. }
  279. .min-icon-button-box{
  280. display flex;
  281. justify-content: flex-start;
  282. flex-wrap: wrap;
  283. width:710rpx;
  284. margin:20rpx;
  285. background :#ffffff;
  286. border-radius:20rpx;
  287. padding-bottom: 20rpx;
  288. view{
  289. width: 176rpx;
  290. img{
  291. height:75rpx;
  292. width:75rpx;
  293. margin:30rpx auto 10rpx;
  294. }
  295. view{
  296. text-align center
  297. font-size:24rpx;
  298. }
  299. }
  300. }
  301. /* 分级管控 */
  302. .grading{
  303. width :712rpx;
  304. height :80rpx;
  305. background: #FFFFFF;
  306. border-radius: 20rpx;
  307. margin-left:20rpx;
  308. margin-bottom :20rpx;
  309. display:flex;
  310. justify-content :flex-start;
  311. align-items :center;
  312. .grading_l{
  313. width :34rpx;
  314. height :34rpx;
  315. margin-left:16rpx;
  316. }
  317. .grading_c{
  318. font-size: 28rpx;
  319. font-family: PingFang SC;
  320. font-weight: 500;
  321. color: #333333;
  322. margin-left:16rpx;
  323. }
  324. .grading_r{
  325. width :504rpx;
  326. height :80rpx;
  327. font-size: 26rpx;
  328. font-family: PingFang SC;
  329. font-weight: 500;
  330. color: #EE3A3A;
  331. display :flex;
  332. justify-content :flex-end;
  333. align-items: center;
  334. >img{
  335. width: 20rpx;
  336. height: 20rpx;
  337. margin-left :20rpx;
  338. margin-top :8rpx;
  339. }
  340. }
  341. }
  342. .big-icon-button-box{
  343. width:710rpx;
  344. height:354rpx;
  345. margin:0 20rpx 20rpx;
  346. background :#ffffff;
  347. border-radius:20rpx;
  348. display flex
  349. .left-box{
  350. width:310rpx;
  351. height:310rpx;
  352. margin:22rpx 10rpx 22rpx 15rpx;
  353. .left-top-img{
  354. width:310rpx;
  355. height:150rpx;
  356. margin-bottom:14rpx;
  357. }
  358. .left-bottom-img{
  359. width:310rpx;
  360. height:150rpx;
  361. }
  362. }
  363. .right-img{
  364. width:362rpx;
  365. height:310rpx;
  366. margin:22rpx 13rpx 22rpx 0;
  367. }
  368. }
  369. .top-max-box{
  370. height:119rpx;
  371. background #fff
  372. overflow hidden
  373. .top-big-box{
  374. height:60rpx;
  375. width:649rpx;
  376. background: #F5F5F5;
  377. border-radius: 30px;
  378. margin:30rpx auto;
  379. padding:0 30rpx;
  380. }
  381. .top-big-one-type{
  382. color:#F95F5F;
  383. line-height:60rpx;
  384. font-size: 26rpx;
  385. }
  386. .top-big-two-type{
  387. line-height:60rpx;
  388. font-size: 26rpx;
  389. display flex
  390. .left-view{
  391. flex:1;
  392. display flex
  393. color:#333;
  394. .left-min-view{
  395. color:#e45656;
  396. }
  397. }
  398. .left-button-view{
  399. color:#0183fa;
  400. }
  401. }
  402. }
  403. .button-max-box{
  404. /*height:446rpx;*/
  405. background #fff
  406. margin-bottom:20rpx;
  407. .button-title{
  408. line-height:100rpx;
  409. border-bottom:1rpx solid #E0E0E0;
  410. padding-left:20rpx;
  411. }
  412. .button-max-box{
  413. /*height:345rpx;*/
  414. .button-min-box{
  415. width:250rpx;
  416. height:172rpx;
  417. display inline-block
  418. img{
  419. width:80rpx;
  420. height:80rpx;
  421. margin:34rpx auto 0;
  422. }
  423. view{
  424. line-height:50rpx;
  425. text-align center;
  426. font-size:28rpx;
  427. color: #333;
  428. }
  429. }
  430. }
  431. }
  432. .bottom-max-box{
  433. flex:1;
  434. background #fff
  435. margin:0 20rpx 100rpx;
  436. border-radius:20rpx;
  437. display flex
  438. flex-direction column
  439. overflow-y hidden
  440. .bottom-title{
  441. display flex
  442. border-bottom:1rpx solid #E0E0E0;
  443. img{
  444. width:34rpx;
  445. height:34rpx;
  446. margin:35rpx 16rpx 0 10rpx;
  447. }
  448. view{
  449. line-height:100rpx;
  450. }
  451. }
  452. .bottom-big-box{
  453. flex:1;
  454. overflow-y scroll
  455. .bottom-for-box:nth-child(1){
  456. border:none;
  457. }
  458. .bottom-for-box{
  459. height:154rpx;
  460. margin:0 20rpx;
  461. border-top:1rpx solid #E0E0E0;
  462. overflow hidden
  463. .bottom-top-box{
  464. font-size:28rpx;
  465. line-height:28rpx;
  466. color:#333;
  467. display:block;
  468. overflow:hidden;
  469. text-overflow:ellipsis;
  470. white-space:nowrap;
  471. margin:36rpx 0 30rpx;
  472. }
  473. .bottom-bottom-box{
  474. display flex
  475. view{
  476. flex:1;
  477. line-height:48rpx;
  478. font-size: 28rpx;
  479. color: #999999;
  480. display:block;
  481. overflow:hidden;
  482. text-overflow:ellipsis;
  483. white-space:nowrap;
  484. }
  485. view:nth-child(2){
  486. text-align right
  487. }
  488. }
  489. }
  490. .null-view{
  491. text-align center;
  492. color:#999;
  493. line-height:80rpx;
  494. font-size:28rpx;
  495. }
  496. }
  497. }
  498. }
  499. </style>