| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <template>
- <button
- open-type="contact"
- :send-message-title="computedTitle"
- :send-message-path="computedPath"
- :send-message-img="img"
- :show-message-card="showMessageCard"
- @contact="onContact"
- class="contact-btn"
- :class="[mode]"
- hover-class="contact-btn-hover"
- >
- <slot />
- </button>
- </template>
- <script setup lang="ts">
- interface Props {
- title?: string
- path?: string
- img?: string
- showMessageCard?: boolean
- mode?: 'inline' | 'menu-item' | 'floating' | 'link'
- }
- const props = withDefaults(defineProps<Props>(), {
- title: '',
- path: '',
- img: '',
- showMessageCard: true,
- mode: 'inline'
- })
- const emit = defineEmits<{
- (e: 'contact', data: any): void
- }>()
- const computedTitle = `客服咨询 - ${props.title || 'AI零售柜'}`
- const computedPath = props.path || '/pages/index/index'
- const onContact = (e: any) => {
- emit('contact', e.detail)
- }
- </script>
- <style lang="scss" scoped>
- .contact-btn {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- padding: 0;
- margin: 0;
- background: transparent;
- border: none;
- line-height: inherit;
- font-size: inherit;
- color: inherit;
- font-weight: inherit;
- &::after {
- border: none;
- }
- &.inline {
- display: inline-flex;
- }
- &.menu-item {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: flex-start;
- padding: $spacing-md $spacing-lg;
- border-radius: 0;
- text-align: left;
- min-height: 88rpx;
- box-sizing: border-box;
- :deep(image),
- ::v-deep image,
- .menu-svg-icon {
- width: 40rpx !important;
- height: 40rpx !important;
- min-width: 40rpx !important;
- min-height: 40rpx !important;
- max-width: 40rpx !important;
- max-height: 40rpx !important;
- }
- &:active {
- background: $color-bg-secondary;
- }
- }
- &.floating {
- position: fixed;
- bottom: 120rpx;
- left: 50%;
- transform: translateX(-50%);
- background: $color-primary;
- color: $color-text-primary;
- padding: $spacing-md $spacing-xl;
- border-radius: $radius-xl;
- font-size: 28rpx;
- font-weight: 500;
- box-shadow: $shadow-primary;
- z-index: 100;
- white-space: nowrap;
- &:active {
- transform: translateX(-50%) scale(0.97);
- }
- }
- &.link {
- display: inline;
- color: $color-primary-dark;
- text-decoration: underline;
- font-size: 28rpx;
- }
- }
- .contact-btn-hover {
- opacity: 0.8;
- }
- </style>
|