studentWorkbench.vue 13 KB

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