userInfoCard.vue 12 KB

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