userInfoCard.vue 13 KB

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