ImportModel.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <cwg-popup
  3. :visible="visible"
  4. :title="t('CountryNotice.title')"
  5. :showClose="false"
  6. :maskClick="false"
  7. @close="handleClose"
  8. @confirm="handleConfirm"
  9. :confirmDisabled="!checked"
  10. :confirmText="t(`CountryNotice.${countryKey}.confirm`)"
  11. >
  12. <view class="dialog-content">
  13. <view class="notice-text">
  14. <text>{{ t(`CountryNotice.${countryKey}.notice1`) }}</text>
  15. <text style="font-weight: bold; display: inline;">{{ t(`CountryNotice.${countryKey}.notice2`) }}</text>
  16. </view>
  17. <view class="notice-text">
  18. <text>{{ t(`CountryNotice.${countryKey}.notice3`) }}</text>
  19. <text style="font-weight: bold; display: inline;">{{ t(`CountryNotice.${countryKey}.notice4`) }}</text>
  20. </view>
  21. <view class="notice-text">
  22. <text>{{ t(`CountryNotice.${countryKey}.notice5`) }}</text>
  23. <text style="font-weight: bold; display: inline;">{{ t(`CountryNotice.${countryKey}.notice6`) }}</text>
  24. <text>{{ t(`CountryNotice.${countryKey}.notice7`) }}</text>
  25. </view>
  26. <view class="checkbox-wrapper" @click="checked = !checked">
  27. <up-checkbox-group>
  28. <up-checkbox size="14" labelSize="14" labelColor="#666666" activeColor="#ea002a"
  29. :checked="checked" :name="true"></up-checkbox>
  30. </up-checkbox-group>
  31. <text class="checkbox-label">{{ t(`CountryNotice.${countryKey}.checkbox`) }}</text>
  32. </view>
  33. </view>
  34. </cwg-popup>
  35. </template>
  36. <script setup>
  37. import { ref, computed, watch } from 'vue'
  38. import { useI18n } from 'vue-i18n'
  39. const { t } = useI18n()
  40. const props = defineProps({
  41. visible: {
  42. type: Boolean,
  43. default: false
  44. },
  45. countryCode: {
  46. type: String,
  47. default: 'MY'
  48. }
  49. })
  50. const emit = defineEmits(['update:visible', 'confirm'])
  51. const checked = ref(false)
  52. const countryKey = computed(() => {
  53. return props.countryCode ? props.countryCode.toLowerCase() : 'my'
  54. })
  55. watch(() => props.visible, (newVal) => {
  56. if (newVal) {
  57. checked.value = false
  58. }
  59. })
  60. const handleClose = () => {
  61. if (checked.value) {
  62. emit('update:visible', false)
  63. } else {
  64. uni.showToast({
  65. title: 'Please check the confirmation box first',
  66. icon: 'none'
  67. })
  68. }
  69. }
  70. const handleConfirm = () => {
  71. if (checked.value) {
  72. emit('update:visible', false)
  73. emit('confirm')
  74. }
  75. }
  76. </script>
  77. <style lang="scss" scoped>
  78. @import "@/uni.scss";
  79. .dialog-content {
  80. padding: px2rpx(10) px2rpx(20);
  81. }
  82. .notice-text {
  83. font-size: px2rpx(14);
  84. line-height: 1.6;
  85. color: #606266;
  86. margin-bottom: px2rpx(10);
  87. text-align: justify;
  88. word-break: break-word;
  89. }
  90. .checkbox-wrapper {
  91. margin-top: px2rpx(20);
  92. margin-bottom: px2rpx(10);
  93. display: flex;
  94. align-items: center;
  95. cursor: pointer;
  96. .checkbox-label {
  97. font-size: px2rpx(14);
  98. color: #666666;
  99. margin-left: px2rpx(8);
  100. user-select: none;
  101. }
  102. :deep(.u-checkbox) {
  103. display: flex;
  104. align-items: flex-start;
  105. }
  106. }
  107. </style>