certificationInfo.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <view class="container">
  3. <!-- 内容区域 -->
  4. <scroll-view class="content" scroll-y>
  5. <view class="info-list">
  6. <view class="info-item">
  7. <view class="info-label">姓名</view>
  8. <view class="info-value">{{ certificationData.name || '-' }}</view>
  9. </view>
  10. <view class="divider"></view>
  11. <view class="info-item">
  12. <view class="info-label">身份证号</view>
  13. <view class="info-value">{{ formatIdNumber(certificationData.idNumber) || '-' }}</view>
  14. </view>
  15. <view class="divider"></view>
  16. <view class="info-item">
  17. <view class="info-label">认证状态</view>
  18. <view class="info-value status-value" :class="getStatusClass(certificationData.status)">
  19. {{ getStatusText(certificationData.status) }}
  20. </view>
  21. </view>
  22. <view class="divider"></view>
  23. <view class="info-item">
  24. <view class="info-label">机构</view>
  25. <view class="info-value">{{ certificationData.institution || '-' }}</view>
  26. </view>
  27. <view class="divider"></view>
  28. <view class="info-item">
  29. <view class="info-label">科室</view>
  30. <view class="info-value">{{ certificationData.department || '-' }}</view>
  31. </view>
  32. <view class="divider"></view>
  33. <view class="info-item">
  34. <view class="info-label">职称</view>
  35. <view class="info-value">{{ certificationData.title || '-' }}</view>
  36. </view>
  37. </view>
  38. </scroll-view>
  39. </view>
  40. </template>
  41. <script>
  42. import { getCertificationInfo } from '@/api-js/certification'
  43. export default {
  44. data() {
  45. return {
  46. certificationData: {
  47. name: '',
  48. idNumber: '',
  49. status: '', // 认证状态:pending-待审核, approved-已认证, rejected-已驳回
  50. institution: '',
  51. department: '',
  52. title: ''
  53. }
  54. }
  55. },
  56. onLoad() {
  57. this.loadCertificationInfo()
  58. },
  59. methods: {
  60. async loadCertificationInfo() {
  61. try {
  62. uni.showLoading({ title: '加载中...' })
  63. const res = await getCertificationInfo()
  64. uni.hideLoading()
  65. if (res.code === 200 && res.data) {
  66. this.certificationData = {
  67. name: res.data.name || '',
  68. idNumber: res.data.idNumber || '',
  69. status: res.data.status || 'pending',
  70. institution: res.data.institution || '',
  71. department: res.data.department || '',
  72. title: res.data.title || ''
  73. }
  74. }
  75. } catch (e) {
  76. uni.hideLoading()
  77. console.error('加载认证信息失败', e)
  78. // 使用示例数据
  79. this.certificationData = {
  80. name: '王小明',
  81. idNumber: '510712345678900029',
  82. status: 'approved',
  83. institution: '北京人民医院',
  84. department: '消化内科',
  85. title: '主任医师/教授'
  86. }
  87. }
  88. },
  89. formatIdNumber(idNumber) {
  90. if (!idNumber) return ''
  91. if (idNumber.length < 8) return idNumber
  92. // 显示前4位和后4位,中间用*号隐藏
  93. const start = idNumber.substring(0, 4)
  94. const end = idNumber.substring(idNumber.length - 4)
  95. const middle = '*'.repeat(idNumber.length - 8)
  96. return start + middle + end
  97. },
  98. getStatusText(status) {
  99. const statusMap = {
  100. 'pending': '待审核',
  101. 'approved': '已认证',
  102. 'rejected': '已驳回'
  103. }
  104. return statusMap[status] || '未知'
  105. },
  106. getStatusClass(status) {
  107. const classMap = {
  108. 'pending': 'status-pending',
  109. 'approved': 'status-approved',
  110. 'rejected': 'status-rejected'
  111. }
  112. return classMap[status] || ''
  113. },
  114. goBack() {
  115. uni.navigateBack()
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. .container {
  122. min-height: 100vh;
  123. background: #fff;
  124. display: flex;
  125. flex-direction: column;
  126. }
  127. .navbar {
  128. display: flex;
  129. align-items: center;
  130. justify-content: space-between;
  131. padding: 20rpx 24rpx;
  132. background: #fff;
  133. border-bottom: 1rpx solid #f0f0f0;
  134. position: sticky;
  135. top: 0;
  136. z-index: 100;
  137. .nav-left {
  138. width: 60rpx;
  139. .back-icon {
  140. font-size: 36rpx;
  141. color: #333;
  142. font-weight: bold;
  143. }
  144. }
  145. .nav-title {
  146. flex: 1;
  147. text-align: center;
  148. font-size: 36rpx;
  149. font-weight: bold;
  150. color: #333;
  151. }
  152. .nav-right {
  153. display: flex;
  154. align-items: center;
  155. gap: 24rpx;
  156. width: 60rpx;
  157. justify-content: flex-end;
  158. .more-icon {
  159. font-size: 32rpx;
  160. color: #333;
  161. }
  162. .eye-icon {
  163. font-size: 32rpx;
  164. color: #333;
  165. }
  166. }
  167. }
  168. .content {
  169. flex: 1;
  170. }
  171. .info-list {
  172. background: #fff;
  173. .info-item {
  174. display: flex;
  175. align-items: center;
  176. justify-content: space-between;
  177. padding: 32rpx 24rpx;
  178. min-height: 100rpx;
  179. .info-label {
  180. font-size: 28rpx;
  181. color: #333;
  182. font-weight: 500;
  183. }
  184. .info-value {
  185. font-size: 28rpx;
  186. color: #666;
  187. text-align: right;
  188. flex: 1;
  189. margin-left: 24rpx;
  190. &.status-value {
  191. font-weight: 500;
  192. &.status-approved {
  193. color: #52C41A;
  194. }
  195. &.status-pending {
  196. color: #FAAD14;
  197. }
  198. &.status-rejected {
  199. color: #FF5030;
  200. }
  201. }
  202. }
  203. }
  204. .divider {
  205. height: 1rpx;
  206. background: #EBEDF0;
  207. margin-left: 24rpx;
  208. }
  209. }
  210. </style>