userInfoCard.vue 12 KB

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