studentWorkbench.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  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="@/images/basicsModules/img_bg_cjcx.png">
  10. <img class="left-bottom-img" @click="goPage('meViolation')" src="@/images/basicsModules/img_bg_wgjl.png">
  11. </view>
  12. <img class="right-img" @click="goNull" src="@/images/basicsModules/img_bg_jfmx.png">
  13. </view>
  14. <view class="bottom-max-box">
  15. <view class="bottom-title">
  16. <img src="@/images/basicsModules/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 '@/api/basicsModules/index.js'
  35. import { tabBar } from '@/component/tabBar.vue'
  36. import { navBar } from '@/component/navbar.vue'
  37. import { homeConfigurationSlot } from '@/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/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. //页面跳转
  137. goPage(type){
  138. if(type == 'meViolation'){//我的违规
  139. uni.navigateTo({
  140. url: '/pages_student/workbench/meViolation',
  141. });
  142. }else if(type == 'photoInspection'){//离开检查
  143. this.outSubjectPhoto();
  144. }else if(type == 'resultInquiry'){//成绩查询
  145. uni.navigateTo({
  146. url: '/pages_student/workbench/resultInquiry',
  147. });
  148. }else if(type == 'casuallyPat'){//随手拍
  149. uni.navigateTo({
  150. url: '/pages/casuallyPat',//随手拍
  151. });
  152. }else if(type == 'safeAccess'){//安全准入
  153. uni.navigateTo({
  154. url: '/pages_student/workbench/safeAccess/safeAccess',
  155. });
  156. }else if(type == 'examList'){//在线考试
  157. uni.navigateTo({
  158. url: '/pages_student/workbench/exam/examList',
  159. });
  160. }else if(type == 'grading'){
  161. uni.navigateTo({
  162. url: '/pages_student/gradingControl/gradingControl',//分级管控
  163. });
  164. }else if(type == 'safetyInspect'){//安全检查
  165. this.getGentleIdentifier();
  166. // uni.navigateTo({
  167. // url: '/pages_manage/workbench/problemRectification/rectifyList',//安全检查
  168. // });
  169. }else if(type == 'gas'){//气瓶管理
  170. uni.navigateTo({
  171. url: '/pages_student/gasManage/gasManage',
  172. });
  173. }else if(type == 'none'){
  174. uni.showToast({
  175. title: '暂未开放',
  176. icon:"none",
  177. mask:true,
  178. duration: 2000
  179. });
  180. }
  181. },
  182. //获取拍照检查配置
  183. async outSubjectPhoto(){
  184. const {data} = await outSubjectPhoto();
  185. if(data.code == 200){
  186. if(data.data == null){
  187. //需要检查(重新填写)
  188. let obj = {
  189. sub:"实验室照片",
  190. subUrl:"",
  191. garbage:"垃圾桶清理后照片",
  192. garbageUrl:"",
  193. dangerous:"使用危险设备照片(选填)",
  194. dangerousUrl:"",
  195. sourceRisk:"危险源设备使用登记本照片(选填)",
  196. sourceRiskUrl:"",
  197. };
  198. uni.navigateTo({
  199. url: '/pages_student/workbench/photoInspection?newData='+encodeURIComponent(JSON.stringify(obj)),
  200. });
  201. }else if(data.data == false){
  202. //不需要检查
  203. uni.showToast({
  204. title: '暂无检查数据',
  205. icon:"none",
  206. mask:true,
  207. duration: 2000
  208. });
  209. }else{
  210. //需要检查(修改内容)
  211. let obj = {
  212. id:data.data.id,
  213. sub:"实验室照片",
  214. subUrl:data.data.subUrl,
  215. garbage:"垃圾桶清理后照片",
  216. garbageUrl:data.data.garbageUrl,
  217. dangerous:"使用危险设备照片(选填)",
  218. dangerousUrl:data.data.dangerousUrl,
  219. sourceRisk:"危险源设备使用登记本照片(选填)",
  220. sourceRiskUrl:data.data.sourceRiskUrl,
  221. };
  222. uni.navigateTo({
  223. url: '/pages_student/workbench/photoInspection?newData='+encodeURIComponent(JSON.stringify(obj)),
  224. });
  225. }
  226. }
  227. },
  228. //获取用户身份标识"adminGentle": false, 管理员身份 "rectifyGentle": false, 整改身份"applyGentle": false 检查者身份
  229. async getGentleIdentifier(){
  230. let self = this;
  231. const {data} = await getGentleIdentifier();
  232. if(data.code==200){
  233. let pageType = null
  234. // 如果是管理员 检查者和整改者
  235. if(data.data.adminGentle && (data.data.applyGentle || data.data.myApplyGentle) && data.data.rectifyGentle){
  236. pageType=1
  237. }else if(data.data.adminGentle && (data.data.applyGentle || data.data.myApplyGentle) && !data.data.rectifyGentle){
  238. pageType=1
  239. }else if(data.data.adminGentle && !data.data.applyGentle && data.data.rectifyGentle){
  240. pageType=1
  241. }else if(!data.data.adminGentle && (data.data.applyGentle || data.data.myApplyGentle) && data.data.rectifyGentle){
  242. pageType=2
  243. }else if(data.data.adminGentle && !data.data.applyGentle && !data.data.rectifyGentle){
  244. pageType=1
  245. }else if(!data.data.adminGentle && (data.data.applyGentle || data.data.myApplyGentle) && !data.data.rectifyGentle){
  246. pageType=2
  247. }else if(!data.data.adminGentle && !data.data.applyGentle && data.data.rectifyGentle){
  248. pageType=3
  249. }
  250. uni.setStorageSync('gentleIdentifier',pageType)
  251. uni.setStorageSync('gentleIdentifierData',data.data)
  252. if(pageType){
  253. uni.navigateTo({
  254. url: '/pages/safetyExamineWorkbench',
  255. });
  256. }else{
  257. uni.showToast({
  258. title: '没有相关权限',
  259. icon:"none",
  260. mask:true,
  261. duration: 2000
  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>