userInfoCard.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  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.totalPoints}}</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. padding: 4rpx 16rpx;
  206. border-radius: 40rpx;
  207. border: 2rpx solid rgba(255, 215, 0, .35);
  208. margin-right: 20rpx;
  209. }
  210. view:nth-child(3) {
  211. background: rgba(0, 210, 140, .18);
  212. color: #7fffd4;
  213. font-size: 22rpx;
  214. padding: 4rpx 16rpx;
  215. border-radius: 40rpx;
  216. border: 2rpx solid rgba(0, 210, 140, .4);
  217. margin-right: 20rpx;
  218. }
  219. }
  220. .account-box {
  221. display: flex;
  222. margin-top: 10rpx;
  223. view {
  224. color: rgba(255, 255, 255, .8);
  225. font-size: 24rpx;
  226. }
  227. view:nth-child(2) {
  228. margin: 0 10rpx;
  229. }
  230. }
  231. .dept-box {
  232. display: flex;
  233. margin-top: 10rpx;
  234. view {
  235. color: rgba(255, 255, 255, .8);
  236. font-size: 24rpx;
  237. }
  238. }
  239. }
  240. .right-type-box {
  241. width: 70rpx;
  242. height: 30rpx;
  243. background: rgba(0, 210, 140, .18);
  244. color: #7fffd4;
  245. font-size: 22rpx;
  246. padding: 4rpx 16rpx;
  247. border-radius: 40rpx;
  248. border: 2rpx solid rgba(0, 210, 140, .4);
  249. display: flex;
  250. margin: 60rpx 20rpx 0 0;
  251. view:nth-child(1) {
  252. width: 10rpx;
  253. height: 10rpx;
  254. border-radius: 50%;
  255. background-color: rgba(0, 210, 140, 1);
  256. text-align: center;
  257. margin: 10rpx 10rpx 0 0;
  258. }
  259. }
  260. }
  261. .bottom-max-big-box {
  262. z-index: 1;
  263. position: relative;
  264. border-radius: 32rpx;
  265. padding: 32rpx;
  266. margin: -36rpx 24rpx 24rpx;
  267. background-color: #fff;
  268. // 1. 绑定实验室样式
  269. .lab-bind-box {
  270. background: #eef3fd;
  271. border-radius: 16rpx;
  272. padding: 20rpx;
  273. margin-bottom: 28rpx;
  274. .lab-title {
  275. font-size: 24rpx;
  276. color: #8896a7;
  277. margin-bottom: 16rpx;
  278. }
  279. .lab-info-row {
  280. display: flex;
  281. align-items: center;
  282. gap: 12rpx;
  283. .dot-green {
  284. width: 12rpx;
  285. height: 12rpx;
  286. border-radius: 50%;
  287. background-color: #0d8f6f;
  288. }
  289. .lab-name {
  290. width: 400rpx;
  291. font-weight: 500;
  292. color: #1857d4;
  293. font-size: 28rpx;
  294. }
  295. }
  296. }
  297. // 2. 学年进度样式
  298. .year-progress-card {
  299. background-color: #f4f6fa;
  300. border-radius: 20rpx;
  301. padding: 28rpx;
  302. margin-bottom: 24rpx;
  303. .card-header {
  304. margin-bottom: 24rpx;
  305. }
  306. .tags-group {
  307. display: flex;
  308. align-items: center;
  309. gap: 16rpx;
  310. }
  311. .progress-info {
  312. margin-bottom: 16rpx;
  313. }
  314. .info-row {
  315. display: flex;
  316. justify-content: space-between;
  317. align-items: center;
  318. margin-bottom: 8rpx;
  319. }
  320. .label {
  321. font-size: 24rpx;
  322. color: #8896a7;
  323. }
  324. .value {
  325. font-size: 24rpx;
  326. }
  327. .progress-wrap {
  328. background-color: #e8edf6;
  329. border-radius: 8rpx;
  330. height: 14rpx;
  331. overflow: hidden;
  332. }
  333. .progress-bar {
  334. height: 100%;
  335. border-radius: 8rpx;
  336. background: linear-gradient(90deg, #2e6fe0, #1857d4);
  337. transition: width 0.4s;
  338. }
  339. .card-footer {
  340. display: flex;
  341. justify-content: space-between;
  342. align-items: center;
  343. }
  344. .footer-left,
  345. .footer-right {
  346. display: flex;
  347. align-items: center;
  348. gap: 8rpx;
  349. }
  350. .exam-link {
  351. color: #1857d4;
  352. font-weight: 600;
  353. background-color: #eef3fd;
  354. padding: 4rpx 16rpx;
  355. border-radius: 12rpx;
  356. border: 1px solid rgba(24, 87, 212, 0.25);
  357. font-size: 24rpx;
  358. }
  359. }
  360. // 3. 任务状态样式
  361. .task-status-box {
  362. .task-title {
  363. font-size: 28rpx;
  364. color: #8896a7;
  365. font-weight: 700;
  366. margin-bottom: 16rpx;
  367. }
  368. .task-grid {
  369. display: grid;
  370. grid-template-columns: 1fr 1fr 1fr;
  371. gap: 16rpx;
  372. .task-item {
  373. border: 1px solid #e8edf6;
  374. border-radius: 16rpx;
  375. padding: 20rpx;
  376. text-align: center;
  377. .task-label {
  378. font-size: 24rpx;
  379. color: #8896a7;
  380. margin-bottom: 8rpx;
  381. }
  382. }
  383. .task-item-active {
  384. border: 1px solid #e0ffc1;
  385. background-color: #f6ffed;
  386. }
  387. }
  388. }
  389. }
  390. // 全局标签样式
  391. .tag {
  392. display: inline-flex;
  393. align-items: center;
  394. padding: 4rpx 16rpx;
  395. border-radius: 40rpx;
  396. font-size: 22rpx;
  397. font-weight: 500;
  398. }
  399. .tag-blue {
  400. background-color: #eef3fd;
  401. color: #1857d4;
  402. }
  403. .tag-green {
  404. background-color: #edfaf6;
  405. color: #0d8f6f;
  406. }
  407. .tag-gray {
  408. background-color: #f4f6fa;
  409. color: #8896a7;
  410. }
  411. .tag-error {
  412. background-color: #fff7d8;
  413. color: #e67e22;
  414. }
  415. .text-sm {
  416. font-size: 24rpx;
  417. }
  418. .text-bold {
  419. font-weight: 600;
  420. }
  421. .text-blue {
  422. color: #1857d4;
  423. }
  424. .text-gray {
  425. color: #8896a7;
  426. }
  427. }
  428. </style>