userInfoCard.vue 14 KB

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