detail.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view class="content">
  3. <view class="one">
  4. <image class="image" :src="info.logo&&info.logo.length>0?info.logo[0].url:''">
  5. </image>
  6. </view>
  7. <view class="two">
  8. <view class="name">{{info.zw||'暂无'}}: {{info.name||'暂无'}}</view>
  9. <view class="other">
  10. <text>姓名:</text>{{info.name||'暂无'}},<text>性别:</text>{{getDict(info.gender,'gender')}},<text>出生年月:</text>{{info.birth||'暂无'}}
  11. </view>
  12. <view class="other">
  13. <text>职务:</text>{{info.zw||'暂无'}},<text>职称:</text>{{info.zc||'暂无'}}
  14. </view>
  15. <view class="other">
  16. <text>执业证号:</text>{{info.number||'暂无'}}
  17. </view>
  18. <view class="list" v-if="info.work&&info.work.length>0">
  19. <text>司法工作经历:</text>
  20. <view class="list_1" v-for="(item, index) in info.work" :key="index" @click="toCommon(item.route)">
  21. <view class="value">{{item.time}}</view>
  22. <view class="value">{{item.address}}</view>
  23. 工作
  24. </view>
  25. </view>
  26. <view class="list">
  27. <text>业务专长:</text>
  28. <view class="content">{{info.brief||'暂无'}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script setup lang="ts">
  34. import { getCurrentInstance, ref } from 'vue';
  35. //该依赖已内置不需要单独安装
  36. import { onLoad } from "@dcloudio/uni-app";
  37. // 请求接口
  38. const $api = getCurrentInstance()?.appContext.config.globalProperties.$api;
  39. // 基本信息
  40. const config = ref({ logo: [], file: [] });
  41. const id = ref('');
  42. const info = ref({});
  43. // 字典表
  44. const educationList = ref([]);
  45. const genderList = ref([]);
  46. onLoad(async (options) => {
  47. id.value = options && options.id
  48. await searchConfig();
  49. await searchOther();
  50. await search();
  51. })
  52. // config信息
  53. const searchConfig = async () => {
  54. config.value = uni.getStorageSync('config');
  55. };
  56. // 其他查询信息
  57. const searchOther = async () => {
  58. let res;
  59. // 性别
  60. res = await $api(`dictData`, 'GET', { code: 'gender', is_use: '0' });
  61. if (res.errcode === 0) genderList.value = res.data;
  62. // 学历
  63. res = await $api(`dictData`, 'GET', { code: 'education', is_use: '0' });
  64. if (res.errcode === 0) educationList.value = res.data;
  65. };
  66. // 查询
  67. const search = async () => {
  68. if (id.value) {
  69. const res = await $api(`personnel/${id.value}`, 'GET', {});
  70. if (res.errcode === 0) {
  71. info.value = res.data
  72. } else {
  73. uni.showToast({
  74. title: res.errmsg || '',
  75. icon: 'error',
  76. });
  77. }
  78. }
  79. };
  80. // 数据处理
  81. const getDict = (data, model) => {
  82. let list;
  83. switch (model) {
  84. case 'gender':
  85. list = genderList.value;
  86. break;
  87. case 'education':
  88. list = educationList.value;
  89. break;
  90. default:
  91. break;
  92. }
  93. if (!list) return;
  94. const res = list.find((f) => f.value == data);
  95. return res?.label || '暂无';
  96. };
  97. </script>
  98. <style lang="scss" scoped>
  99. .content {
  100. display: flex;
  101. flex-direction: column;
  102. .one {
  103. display: flex;
  104. justify-content: center;
  105. margin: 2vw;
  106. }
  107. .two {
  108. padding: 2vw;
  109. .name {
  110. margin: 2vw 0;
  111. font-size: var(--font16Size);
  112. }
  113. .other {
  114. margin: 2vw 0;
  115. font-size: var(--font14Size);
  116. text {
  117. color: var(--f85Color);
  118. }
  119. }
  120. .list {
  121. text {
  122. margin: 2vw 0;
  123. font-size: var(--font14Size);
  124. }
  125. .list_1 {
  126. display: flex;
  127. font-size: var(--font12Size);
  128. color: var(--f85Color);
  129. margin: 1vw;
  130. }
  131. .content {
  132. margin: 1vw;
  133. font-size: var(--font14Size);
  134. }
  135. }
  136. }
  137. }
  138. </style>