userInfoCard.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  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. @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:true,
  137. }
  138. },
  139. mounted() {
  140. this.examElLabEduRelationBindStatus();
  141. },
  142. methods: {
  143. // 绑定成功后的回调
  144. refreshPageData() {
  145. // 重新获取用户信息或刷新页面数据
  146. this.examElLabEduRelationBindStatus();
  147. },
  148. handleExamClick() {
  149. // 这里写跳转到考试详情页的逻辑
  150. uni.navigateTo({
  151. url: '/pages_safetyEducationExamination/screen-exam-detail/screen-exam-detail' // 根据实际路径修改
  152. });
  153. },
  154. // 获取用户信息
  155. async examElLabEduRelationBindStatus() {
  156. const {
  157. data
  158. } = await examElLabEduRelationBindStatus({});
  159. if (data.code == 200) {
  160. // 使用 Object.assign 保留默认值,同时更新接口返回的数据
  161. // Object.assign(this.userInfo, data.data);
  162. this.$set(this,'userInfo',data.data);
  163. }
  164. },
  165. //关闭弹层
  166. shadeButton(type){
  167. let self = this;
  168. if(type == 1){
  169. //提交
  170. this.$refs["shadeForm"].validate(valid => {
  171. if (valid) {
  172. this.$confirm('确认提交?', "提示", {
  173. confirmButtonText: "确认",
  174. cancelButtonText: "取消",
  175. type: "warning"
  176. }).then(function() {
  177. }).then(() => {
  178. self.examElLabEduRelationBind();
  179. }).catch(() => {});
  180. }
  181. })
  182. }else if(type == 2){
  183. //查看通知
  184. this.$set(this,'shadeType',2);
  185. }else if(type == 3 || type == 33){
  186. if(type == 3){
  187. //关闭通知
  188. this.$set(this.shadeFormData,'checkType',true);
  189. this.$set(this,'shadeType',1);
  190. }else if(type == 33){
  191. //关闭通知
  192. this.$set(this.shadeFormData,'checkType',false);
  193. this.$set(this,'shadeType',1);
  194. }
  195. }else if(type == 4||type == 5){
  196. //开启
  197. this.$set(this,'shadeFormData',{
  198. subId:null,
  199. reason:'',
  200. isEnter:false,
  201. checkType:false,
  202. offType:type == 4?true:false,
  203. });
  204. this.$set(this,'shadeType',1);
  205. }else if(type == 6){
  206. //关闭
  207. this.$set(this,'shadeType',null);
  208. }
  209. },
  210. }
  211. }
  212. </script>
  213. <style lang="stylus" scoped>
  214. .safetyEducationExamination-workbench-userInfoCard {
  215. .top-max-big-box {
  216. z-index: 0;
  217. height: 200rpx;
  218. background-color: #1959D5;
  219. overflow: hidden;
  220. display: flex;
  221. .avatar-img {
  222. border: 4rpx solid #87A8E9;
  223. border-radius: 50%;
  224. width: 98rpx;
  225. height: 98rpx;
  226. margin: 32rpx 32rpx 0 32rpx;
  227. }
  228. .center-info-box {
  229. flex: 1;
  230. margin-top:22rpx;
  231. .name-box {
  232. display: flex;
  233. margin-top: 18rpx;
  234. view:nth-child(1) {
  235. font-size: 34rpx;
  236. font-weight: 700;
  237. color: #fff;
  238. margin-right: 20rpx;
  239. }
  240. view:nth-child(2) {
  241. background: rgba(255, 215, 0, .2);
  242. color: #ffe066;
  243. font-size: 22rpx;
  244. padding: 4rpx 16rpx;
  245. border-radius: 40rpx;
  246. border: 2rpx solid rgba(255, 215, 0, .35);
  247. margin-right: 20rpx;
  248. }
  249. view:nth-child(3) {
  250. background: rgba(0, 210, 140, .18);
  251. color: #7fffd4;
  252. font-size: 22rpx;
  253. padding: 4rpx 16rpx;
  254. border-radius: 40rpx;
  255. border: 2rpx solid rgba(0, 210, 140, .4);
  256. margin-right: 20rpx;
  257. }
  258. }
  259. .account-box {
  260. display: flex;
  261. margin-top: 10rpx;
  262. view {
  263. color: rgba(255, 255, 255, .8);
  264. font-size: 24rpx;
  265. }
  266. view:nth-child(2) {
  267. margin: 0 10rpx;
  268. }
  269. }
  270. .dept-box {
  271. display: flex;
  272. margin-top: 10rpx;
  273. view {
  274. color: rgba(255, 255, 255, .8);
  275. font-size: 24rpx;
  276. }
  277. }
  278. }
  279. .right-type-box {
  280. width: 70rpx;
  281. height: 30rpx;
  282. background: rgba(0, 210, 140, .18);
  283. color: #7fffd4;
  284. font-size: 22rpx;
  285. padding: 4rpx 16rpx;
  286. border-radius: 40rpx;
  287. border: 2rpx solid rgba(0, 210, 140, .4);
  288. display: flex;
  289. margin: 60rpx 20rpx 0 0;
  290. view:nth-child(1) {
  291. width: 10rpx;
  292. height: 10rpx;
  293. border-radius: 50%;
  294. background-color: rgba(0, 210, 140, 1);
  295. text-align: center;
  296. margin: 10rpx 10rpx 0 0;
  297. }
  298. }
  299. }
  300. .bottom-max-big-box {
  301. z-index: 1;
  302. position: relative;
  303. border-radius: 32rpx;
  304. padding: 32rpx;
  305. margin: -36rpx 24rpx 24rpx;
  306. background-color: #fff;
  307. // 1. 绑定实验室样式
  308. .lab-bind-box {
  309. background: #eef3fd;
  310. border-radius: 16rpx;
  311. padding: 20rpx;
  312. margin-bottom: 28rpx;
  313. .lab-title {
  314. font-size: 24rpx;
  315. color: #8896a7;
  316. margin-bottom: 16rpx;
  317. }
  318. .lab-info-row {
  319. display: flex;
  320. align-items: center;
  321. gap: 12rpx;
  322. .dot-green {
  323. width: 12rpx;
  324. height: 12rpx;
  325. border-radius: 50%;
  326. background-color: #0d8f6f;
  327. }
  328. .lab-name {
  329. font-weight: 500;
  330. color: #1857d4;
  331. font-size: 28rpx;
  332. }
  333. }
  334. }
  335. // 2. 学年进度样式
  336. .year-progress-card {
  337. background-color: #f4f6fa;
  338. border-radius: 20rpx;
  339. padding: 28rpx;
  340. margin-bottom: 24rpx;
  341. .card-header {
  342. margin-bottom: 24rpx;
  343. }
  344. .tags-group {
  345. display: flex;
  346. align-items: center;
  347. gap: 16rpx;
  348. }
  349. .progress-info {
  350. margin-bottom: 16rpx;
  351. }
  352. .info-row {
  353. display: flex;
  354. justify-content: space-between;
  355. align-items: center;
  356. margin-bottom: 8rpx;
  357. }
  358. .label {
  359. font-size: 24rpx;
  360. color: #8896a7;
  361. }
  362. .value {
  363. font-size: 24rpx;
  364. }
  365. .progress-wrap {
  366. background-color: #e8edf6;
  367. border-radius: 8rpx;
  368. height: 14rpx;
  369. overflow: hidden;
  370. }
  371. .progress-bar {
  372. height: 100%;
  373. border-radius: 8rpx;
  374. background: linear-gradient(90deg, #2e6fe0, #1857d4);
  375. transition: width 0.4s;
  376. }
  377. .card-footer {
  378. display: flex;
  379. justify-content: space-between;
  380. align-items: center;
  381. }
  382. .footer-left,
  383. .footer-right {
  384. display: flex;
  385. align-items: center;
  386. gap: 8rpx;
  387. }
  388. .exam-link {
  389. color: #1857d4;
  390. font-weight: 600;
  391. background-color: #eef3fd;
  392. padding: 4rpx 16rpx;
  393. border-radius: 12rpx;
  394. border: 1px solid rgba(24, 87, 212, 0.25);
  395. font-size: 24rpx;
  396. }
  397. }
  398. // 3. 任务状态样式
  399. .task-status-box {
  400. .task-title {
  401. font-size: 28rpx;
  402. color: #8896a7;
  403. font-weight: 700;
  404. margin-bottom: 16rpx;
  405. }
  406. .task-grid {
  407. display: grid;
  408. grid-template-columns: 1fr 1fr 1fr;
  409. gap: 16rpx;
  410. .task-item {
  411. border: 1px solid #e8edf6;
  412. border-radius: 16rpx;
  413. padding: 20rpx;
  414. text-align: center;
  415. .task-label {
  416. font-size: 24rpx;
  417. color: #8896a7;
  418. margin-bottom: 8rpx;
  419. }
  420. }
  421. .task-item-active {
  422. border: 1px solid #e0ffc1;
  423. background-color: #f6ffed;
  424. }
  425. }
  426. }
  427. }
  428. // 全局标签样式
  429. .tag {
  430. display: inline-flex;
  431. align-items: center;
  432. padding: 4rpx 16rpx;
  433. border-radius: 40rpx;
  434. font-size: 22rpx;
  435. font-weight: 500;
  436. }
  437. .tag-blue {
  438. background-color: #eef3fd;
  439. color: #1857d4;
  440. }
  441. .tag-green {
  442. background-color: #edfaf6;
  443. color: #0d8f6f;
  444. }
  445. .tag-gray {
  446. background-color: #f4f6fa;
  447. color: #8896a7;
  448. }
  449. .tag-error {
  450. background-color: #fff7d8;
  451. color: #e67e22;
  452. }
  453. .text-sm {
  454. font-size: 24rpx;
  455. }
  456. .text-bold {
  457. font-weight: 600;
  458. }
  459. .text-blue {
  460. color: #1857d4;
  461. }
  462. .text-gray {
  463. color: #8896a7;
  464. }
  465. }
  466. </style>