identification.vue 2.7 KB

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