identification.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view>
  3. <uni-popup ref="popupRef" type="dialog" :animation="false" :is-mask-click="false"
  4. mask-background-color="rgba(0, 0, 0, 0.4);">
  5. <uni-popup-dialog mode="input" class="phone-ksxz-dialog" title="身份确认" :duration="2000" :before-close="true"
  6. cancelText="修改" @close="handleClose" @confirm="handleConfirm">
  7. <view class="phone-ksxz-body">
  8. <view @click="handleCloseOnly" class="ksxz-close-icon"
  9. :style="{ backgroundImage: 'url(' + data.iconsArr.closeIcon + ')' }"></view>
  10. <view class="ksxz-content-box">
  11. <!-- Fixme 图形 -->
  12. <view class="ksxz-img-box">
  13. <img :src="data.icon" v-if="data.icon" alt="">
  14. <icon class="phone-default-userImg" v-else></icon>
  15. </view>
  16. <view :class="{isEmpty: !data.realName}">姓名:{{data.realName}}</view>
  17. <view :class="{isEmpty: !data.realName}">电话:{{data.userName}}</view>
  18. <view>职业:{{data.zyName}}</view>
  19. <view>等级:{{data.zyLevelName}}</view>
  20. <view :class="{isEmpty: !data.realName}">证件号:{{data.idcard}}</view>
  21. </view>
  22. </view>
  23. </uni-popup-dialog>
  24. </uni-popup>
  25. </view>
  26. </template>
  27. <script setup>
  28. import {ref,reactive,onMounted} from "vue"
  29. import cacheManager from '@/utils/cacheManager.js';
  30. const popupRef = ref(null)
  31. const data = reactive({
  32. realName: '',
  33. userName: '',
  34. zyLevelName: '',
  35. zyName: '',
  36. idcard: '',
  37. icon: '',
  38. gender: '',
  39. userId: '',
  40. iconsArr:{
  41. closeIcon: '',
  42. }
  43. })
  44. const emits = defineEmits(['confirm', 'changeData'])
  45. onMounted(() => {
  46. data.iconsArr.closeIcon = cacheManager.get('projectImg').closeIcon;
  47. });
  48. function handleCloseOnly() {
  49. popupRef.value.close()
  50. }
  51. function showDialog(options) {
  52. data.realName = options.realName;
  53. data.userName = options.userName;
  54. data.zyLevelName = options.zyLevelName;
  55. data.zyName = options.zyName;
  56. data.idcard = options.idcard;
  57. data.icon = options.icon;
  58. data.userId = options.userId;
  59. data.gender = options.gender; // 1男 2女 0未知
  60. popupRef.value.open()
  61. }
  62. function handleClose() {
  63. emits('changeData');
  64. popupRef.value.close()
  65. }
  66. function handleConfirm() {
  67. let arr = [];
  68. if (!data.realName) {
  69. arr.push('姓名');
  70. }
  71. if (!data.userName) {
  72. arr.push('电话');
  73. }
  74. if (!data.icon) {
  75. arr.push('头像');
  76. }
  77. if (!data.idcard) {
  78. arr.push('证件号');
  79. }
  80. if (!data.realName || !data.userName||!data.icon||!data.idcard) {
  81. uni.showToast({
  82. icon: 'none',
  83. title: `请完善${arr.join('、')}信息!`
  84. })
  85. return;
  86. }
  87. emits('confirm', data);
  88. popupRef.value.close()
  89. }
  90. defineExpose({
  91. showDialog
  92. })
  93. </script>
  94. <style scoped lang="scss">
  95. .isEmpty {
  96. color: #ff0101;
  97. }
  98. </style>