userInfoCard.vue 12 KB

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