userInfoCard.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. <template>
  2. <view class='safetyEducationExamination-workbench-userInfoCard'>
  3. <!-- 顶部用户信息卡片 -->
  4. <view class="top-max-big-box">
  5. <img v-if="userInfo.avatar" class="avatar-img" :src="baseUrl+userInfo.avatar">
  6. <img v-else class="avatar-img" :src="imagesUrl('commonality/icon_01.png')">
  7. <view class="center-info-box">
  8. <view class="name-box-2">
  9. <view>{{userInfo.userName}}</view>
  10. </view>
  11. <view class="account-box">
  12. <view>{{userInfo.userType == 2?userInfo.educationName:(userInfo.userType == 1?'教职工':'系统用户')}}</view>
  13. <view> · </view>
  14. <view>{{userInfo.account}}</view>
  15. <view> · </view>
  16. <view>{{userInfo.deptName}}</view>
  17. </view>
  18. <view class="name-box-1">
  19. <view>奖励分 {{userInfo.totalPoints?userInfo.totalPoints:0}}</view>
  20. <view>信用分 {{userInfo.scoreCredit?userInfo.scoreCredit:0}}</view>
  21. </view>
  22. <!-- <view class="dept-box">
  23. <view>{{userInfo.deptName}}</view>
  24. </view> -->
  25. </view>
  26. <!-- <view class="right-type-box">
  27. <view></view>
  28. <view>正常</view>
  29. </view> -->
  30. </view>
  31. <!-- 底部详情卡片 -->
  32. <view class="bottom-max-big-box">
  33. <!-- 1. 绑定实验室 -->
  34. <view class="lab-bind-box" v-if="userInfo.userType == 2">
  35. <view class="lab-title">{{userInfo.bound?'实验室信息':'绑定实验室'}}</view>
  36. <view class="lab-info-row">
  37. <view class="dot dot-green" v-if="userInfo.bound"></view>
  38. <view class="dot dot-green" style="background-color: #999;" v-if="!userInfo.bound"></view>
  39. <text class="lab-name" v-if="userInfo.bound&&userInfo.labName">{{ userInfo.labName }}</text>
  40. <text class="lab-name" style="color:#999;" v-if="!userInfo.bound&&userInfo.educationType == 1">暂无绑定实验室</text>
  41. <text class="lab-name" style="color:#999;" v-if="!userInfo.bound&&userInfo.educationType == 2">{{userInfo.isFinishExam?'暂无绑定实验室':'请先完成入学考试'}}</text>
  42. <text class="tag" style="color:#1857d4;font-size:28rpx;font-weight:600;" v-if="(!userInfo.bound&&userInfo.educationType == 1)||(!userInfo.bound&&userInfo.educationType == 2&&userInfo.isFinishExam)" @click="shadeButton(4)">去绑定</text>
  43. <text class="tag tag-green" v-if="userInfo.bound">{{userInfo.bindStatus}}</text>
  44. </view>
  45. </view>
  46. <!-- 2. 学年进度 -->
  47. <view class="year-progress-card">
  48. <view class="card-header">
  49. <view class="tags-group">
  50. <text class="tag tag-blue">{{userInfo.gradeRange}}</text>
  51. <text class="tag" :style="'color:'+userInfo.levelColor+';border:1rpx solid '+userInfo.levelColor+';'"
  52. v-if="userInfo.levelName">{{userInfo.levelName}}</text>
  53. <text class="tag tag-gray" v-if="userInfo.typeName">{{userInfo.typeName}}</text>
  54. </view>
  55. </view>
  56. <view class="progress-info" v-if="userInfo.totalStudyHours>0">
  57. <view class="info-row">
  58. <text class="label">当前学年学时完成进度</text>
  59. <text class="value text-blue text-bold">{{ userInfo.completedStudyHours }} / {{ userInfo.totalStudyHours }} 学时</text>
  60. </view>
  61. <view class="progress-wrap">
  62. <view class="progress-bar" :style="{ width: (userInfo.studyHourRate) + '%' }"></view>
  63. </view>
  64. </view>
  65. <view class="card-footer">
  66. <view class="footer-left">
  67. <text class="text-sm text-gray">{{userInfo.totalStudyHours>0?'学时完成度':'学时要求'}}</text>
  68. <text class="text-bold text-blue">{{userInfo.totalStudyHours>0?userInfo.studyHourRate+'%':'无'}}</text>
  69. </view>
  70. </view>
  71. <view class="card-footer" style="margin-top:10rpx;">
  72. <view class="footer-right">
  73. <text class="text-sm text-gray">目标考试</text>
  74. <text class="exam-link">{{userInfo.targetExamName?userInfo.targetExamName:'无'}}</text>
  75. </view>
  76. </view>
  77. </view>
  78. <!-- 3. 任务状态 -->
  79. <view class="task-status-box">
  80. <view class="task-title">当前学年任务状态</view>
  81. <view class="task-grid">
  82. <view class="task-item">
  83. <view class="task-label" :class="userInfo.examPassStatus==1?'task-item-active':''">考试状态</view>
  84. <text class="tag" :class="!userInfo.examPassStatus||userInfo.examPassStatus==1?'tag-gray':(userInfo.examPassStatus==2?'tag-green':(userInfo.examPassStatus==3||userInfo.examPassStatus==4?'tag-error':''))">
  85. {{!userInfo.examPassStatus?'暂无':(userInfo.examPassStatus==1?'考试中':((userInfo.examPassStatus==2?'已通过':(userInfo.examPassStatus==3?'未通过':(userInfo.examPassStatus==4?'缺考':'')))))}}
  86. </text>
  87. </view>
  88. <view class="task-item" :class="userInfo.certificateStatus==1?'task-item-active':''">
  89. <view class="task-label">证书状态</view>
  90. <text class="tag" :class="!userInfo.certificateStatus?'tag-gray':(userInfo.certificateStatus==1?'tag-green':(userInfo.certificateStatus==2||userInfo.certificateStatus==3||userInfo.certificateStatus==4?'tag-error':''))">
  91. {{!userInfo.certificateStatus?'暂无':(userInfo.certificateStatus==1?'已通过':(userInfo.certificateStatus==2?'失效':(userInfo.certificateStatus==3?'已撤销':(userInfo.certificateStatus==4?'未签发':''))))}}
  92. </text>
  93. </view>
  94. <view class="task-item" :class="userInfo.approvalStatus==1?'task-item-active':''" v-if="userInfo.approvalStatus!=3&&userInfo.userType == 2">
  95. <view class="task-label">审批状态</view>
  96. <text class="tag" :class="userInfo.approvalStatus==0?'tag-gray':(userInfo.approvalStatus==1?'tag-green':(userInfo.approvalStatus==2?'tag-error':'tag-gray'))">
  97. {{userInfo.bound&&userInfo.approvalStatus==0?'待审批':(userInfo.approvalStatus==1?'已通过':(userInfo.approvalStatus==2?'未通过':'待绑定'))}}
  98. </text>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. <BindLabModal
  104. :visible="showBindLabModal"
  105. :off-type="bindLabOffType"
  106. :education-type="userInfo.educationType"
  107. @close="showBindLabModal = false"
  108. @bind-success="refreshPageData"
  109. />
  110. </view>
  111. </template>
  112. <script>
  113. import {
  114. config
  115. } from '@/api/request/config.js'
  116. import {
  117. examElLabEduRelationBindStatus
  118. } from '@/pages_safetyEducationExamination/api/index.js'
  119. import BindLabModal from './BindLabModal.vue'
  120. export default {
  121. components: { BindLabModal },
  122. data() {
  123. return {
  124. baseUrl: config.base_url,
  125. userInfo: {
  126. userType: '',
  127. userName: '',
  128. account: '',
  129. educationName: '',
  130. deptName: '',
  131. labName: '',
  132. bound: '',
  133. approvalStatus: '',
  134. certificateStatus: '',
  135. examPassStatus: '',
  136. gradeRange: '',
  137. typeName: '',
  138. completedStudyHours: '',
  139. totalStudyHours: '',
  140. studyHourRate: '',
  141. targetExamName: '',
  142. },
  143. showBindLabModal: false,
  144. bindLabOffType: true,
  145. }
  146. },
  147. mounted() {
  148. this.loadUserInfo();
  149. },
  150. methods: {
  151. refreshPageData() {
  152. this.loadUserInfo();
  153. },
  154. async loadUserInfo() {
  155. const { data } = await examElLabEduRelationBindStatus({});
  156. if (data.code == 200) {
  157. this.$set(this, 'userInfo', data.data);
  158. if (data.data.isPopup) {
  159. this.bindLabOffType = false;
  160. this.showBindLabModal = true;
  161. }
  162. }
  163. },
  164. shadeButton(type) {
  165. if (type == 4) {
  166. this.bindLabOffType = true;
  167. this.showBindLabModal = true;
  168. } else if (type == 5) {
  169. this.bindLabOffType = false;
  170. this.showBindLabModal = true;
  171. }
  172. },
  173. }
  174. }
  175. </script>
  176. <style lang="stylus" scoped>
  177. .safetyEducationExamination-workbench-userInfoCard {
  178. .top-max-big-box {
  179. z-index: 0;
  180. height: 240rpx;
  181. background-color: #1959D5;
  182. overflow: hidden;
  183. display: flex;
  184. .avatar-img {
  185. border: 4rpx solid #87A8E9;
  186. border-radius: 50%;
  187. width: 98rpx;
  188. height: 98rpx;
  189. margin: 48rpx 32rpx 0 32rpx;
  190. }
  191. .center-info-box {
  192. flex: 1;
  193. margin-top:22rpx;
  194. .name-box-1 {
  195. display: flex;
  196. margin-top: 18rpx;
  197. view:nth-child(1) {
  198. background: rgba(255, 215, 0, .2);
  199. color: #ffe066;
  200. font-size: 22rpx;
  201. line-height:40rpx;
  202. padding: 0 16rpx;
  203. border-radius: 40rpx;
  204. border: 2rpx solid rgba(255, 215, 0, .35);
  205. margin-right: 20rpx;
  206. }
  207. view:nth-child(2) {
  208. background: rgba(0, 210, 140, .18);
  209. color: #7fffd4;
  210. font-size: 22rpx;
  211. line-height:40rpx;
  212. padding: 0 16rpx;
  213. border-radius: 40rpx;
  214. border: 2rpx solid rgba(0, 210, 140, .4);
  215. margin-right: 20rpx;
  216. }
  217. }
  218. .name-box-2 {
  219. display: flex;
  220. margin-top: 8rpx;
  221. view:nth-child(1) {
  222. font-size: 34rpx;
  223. font-weight: 700;
  224. color: #fff;
  225. margin-right: 20rpx;
  226. }
  227. }
  228. .account-box {
  229. display: flex;
  230. margin-top: 10rpx;
  231. view {
  232. color: rgba(255, 255, 255, .8);
  233. font-size: 24rpx;
  234. }
  235. view:nth-child(2) {
  236. margin: 0 10rpx;
  237. }
  238. view:nth-child(4) {
  239. margin: 0 10rpx;
  240. }
  241. }
  242. .dept-box {
  243. display: flex;
  244. margin-top: 10rpx;
  245. view {
  246. color: rgba(255, 255, 255, .8);
  247. font-size: 24rpx;
  248. }
  249. }
  250. }
  251. .right-type-box {
  252. width: 70rpx;
  253. height: 30rpx;
  254. background: rgba(0, 210, 140, .18);
  255. color: #7fffd4;
  256. font-size: 22rpx;
  257. padding: 4rpx 16rpx;
  258. border-radius: 40rpx;
  259. border: 2rpx solid rgba(0, 210, 140, .4);
  260. display: flex;
  261. margin: 60rpx 20rpx 0 0;
  262. view:nth-child(1) {
  263. width: 10rpx;
  264. height: 10rpx;
  265. border-radius: 50%;
  266. background-color: rgba(0, 210, 140, 1);
  267. text-align: center;
  268. margin: 10rpx 10rpx 0 0;
  269. }
  270. }
  271. }
  272. .bottom-max-big-box {
  273. z-index: 1;
  274. position: relative;
  275. border-radius: 32rpx;
  276. padding: 32rpx;
  277. margin: -36rpx 24rpx 24rpx;
  278. background-color: #fff;
  279. // 1. 绑定实验室样式
  280. .lab-bind-box {
  281. background: #eef3fd;
  282. border-radius: 16rpx;
  283. padding: 20rpx;
  284. margin-bottom: 28rpx;
  285. .lab-title {
  286. font-size: 24rpx;
  287. color: #8896a7;
  288. margin-bottom: 16rpx;
  289. }
  290. .lab-info-row {
  291. display: flex;
  292. align-items: center;
  293. gap: 12rpx;
  294. .dot-green {
  295. width: 12rpx;
  296. height: 12rpx;
  297. border-radius: 50%;
  298. background-color: #0d8f6f;
  299. }
  300. .lab-name {
  301. width: 400rpx;
  302. font-weight: 500;
  303. color: #1857d4;
  304. font-size: 28rpx;
  305. }
  306. }
  307. }
  308. // 2. 学年进度样式
  309. .year-progress-card {
  310. background-color: #f4f6fa;
  311. border-radius: 20rpx;
  312. padding: 28rpx;
  313. margin-bottom: 24rpx;
  314. .card-header {
  315. margin-bottom: 24rpx;
  316. }
  317. .tags-group {
  318. display: flex;
  319. align-items: center;
  320. gap: 16rpx;
  321. }
  322. .progress-info {
  323. margin-bottom: 16rpx;
  324. }
  325. .info-row {
  326. display: flex;
  327. justify-content: space-between;
  328. align-items: center;
  329. margin-bottom: 8rpx;
  330. }
  331. .label {
  332. font-size: 24rpx;
  333. color: #8896a7;
  334. }
  335. .value {
  336. font-size: 24rpx;
  337. }
  338. .progress-wrap {
  339. background-color: #e8edf6;
  340. border-radius: 8rpx;
  341. height: 14rpx;
  342. overflow: hidden;
  343. }
  344. .progress-bar {
  345. height: 100%;
  346. border-radius: 8rpx;
  347. background: linear-gradient(90deg, #2e6fe0, #1857d4);
  348. transition: width 0.4s;
  349. }
  350. .card-footer {
  351. display: flex;
  352. justify-content: space-between;
  353. align-items: center;
  354. }
  355. .footer-left,
  356. .footer-right {
  357. display: flex;
  358. align-items: center;
  359. gap: 8rpx;
  360. }
  361. .exam-link {
  362. color: #1857d4;
  363. font-weight: 600;
  364. background-color: #eef3fd;
  365. padding: 4rpx 16rpx;
  366. border-radius: 12rpx;
  367. border: 1px solid rgba(24, 87, 212, 0.25);
  368. font-size: 24rpx;
  369. }
  370. }
  371. // 3. 任务状态样式
  372. .task-status-box {
  373. .task-title {
  374. font-size: 28rpx;
  375. color: #8896a7;
  376. font-weight: 700;
  377. margin-bottom: 16rpx;
  378. }
  379. .task-grid {
  380. display: grid;
  381. grid-template-columns: 1fr 1fr 1fr;
  382. gap: 16rpx;
  383. display: flex;
  384. .task-item {
  385. flex:1;
  386. border: 1px solid #e8edf6;
  387. border-radius: 16rpx;
  388. padding: 20rpx;
  389. text-align: center;
  390. .task-label {
  391. font-size: 24rpx;
  392. color: #8896a7;
  393. margin-bottom: 8rpx;
  394. }
  395. }
  396. .task-item-active {
  397. border: 1px solid #e0ffc1;
  398. background-color: #f6ffed;
  399. }
  400. }
  401. }
  402. }
  403. // 全局标签样式
  404. .tag {
  405. display: inline-flex;
  406. align-items: center;
  407. padding: 4rpx 16rpx;
  408. border-radius: 40rpx;
  409. font-size: 22rpx;
  410. font-weight: 500;
  411. }
  412. .tag-blue {
  413. background-color: #eef3fd;
  414. color: #1857d4;
  415. }
  416. .tag-green {
  417. background-color: #edfaf6;
  418. color: #0d8f6f;
  419. }
  420. .tag-gray {
  421. background-color: #f4f6fa;
  422. color: #8896a7;
  423. }
  424. .tag-error {
  425. background-color: #fff7d8;
  426. color: #e67e22;
  427. }
  428. .text-sm {
  429. font-size: 24rpx;
  430. }
  431. .text-bold {
  432. font-weight: 600;
  433. }
  434. .text-blue {
  435. color: #1857d4;
  436. }
  437. .text-gray {
  438. color: #8896a7;
  439. }
  440. }
  441. </style>