certificationInfo.vue 5.1 KB

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