workbench.vue 12 KB

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