identification.vue 2.3 KB

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