workbench.vue 12 KB

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