studentWorkbench.vue 14 KB

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