studentWorkbench.vue 13 KB

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