| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <template>
- <view>
- <CustomPopup v-model="show" mode="center" width="700rpx" bgColor="transparent" :maskClosable="true">
- <view class="share-popup-content">
- <!-- Background Image -->
- <image class="bg-image" src="/pages-sell/static/goods/icon-share-bg.png" mode="widthFix"></image>
- <!-- Close Button -->
- <view class="close-btn" @click="close">
- <image src="/pages-sell/static/goods/icon-close.png" mode="widthFix"></image>
- </view>
- <!-- Main Content -->
- <view class="main-box">
- <view class="title">分享</view>
- <view class="share-options">
- <view class="share-item">
- <button class="share-btn" open-type="share">
- <image src="/pages-sell/static/goods/icon-wx.png" mode="widthFix"></image>
- <text>微信好友</text>
- </button>
- </view>
- <view class="share-item" @click="onGeneratePoster">
- <image src="/pages-sell/static/goods/icon-pic.png" mode="widthFix"></image>
- <text>生成海报</text>
- </view>
- </view>
- </view>
- </view>
- </CustomPopup>
-
- <!-- Poster Popup -->
- <PosterPopup ref="posterPopup" :product="product" :userInfo="userInfo"></PosterPopup>
- </view>
- </template>
- <script>
- import CustomPopup from '@/components/custom-popup.vue';
- import PosterPopup from './poster-popup.vue';
- import { mapState } from 'vuex';
- export default {
- name: 'SharePopup',
- components: {
- CustomPopup,
- PosterPopup
- },
- props: {
- product: {
- type: Object,
- default: () => ({})
- }
- },
- computed: {
- ...mapState('user', ['userInfo'])
- },
- data() {
- return {
- show: false
- };
- },
- methods: {
- open() {
- this.show = true;
- },
- close() {
- this.show = false;
- },
- onGeneratePoster() {
- this.close();
- // Wait for close animation or immediate?
- // Usually immediate is fine, but if mask fades out, it might look weird.
- // But CustomPopup v-model controls visibility.
- this.$nextTick(() => {
- this.$refs.posterPopup.open();
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .share-popup-content {
- position: relative;
- width: 100%;
- // Remove padding-top as background image defines the shape
- }
- .bg-image {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- z-index: 0;
- }
- .close-btn {
- position: absolute;
- top: -40rpx; // Position outside the card
- right: 20rpx;
- width: 80rpx;
- height: 80rpx;
- z-index: 10;
- display: flex;
- align-items: center;
- justify-content: center;
- image {
- width: 60rpx;
- }
- }
- .main-box {
- // Remove background and border-radius as they are provided by image
- position: relative;
- z-index: 1;
- padding: 80rpx 40rpx 60rpx; // Adjust padding to fit content within the background image design
- .title {
- font-size: 36rpx;
- font-weight: bold;
- color: #308740;
- margin-bottom: 60rpx;
- padding-left: 30rpx;
- }
- .share-options {
- display: flex;
- justify-content: space-around;
- padding: 0 40rpx;
- padding-top: 60rpx;
- .share-item {
- display: flex;
- flex-direction: column;
- align-items: center;
-
- .share-btn {
- display: flex;
- flex-direction: column;
- align-items: center;
- background: none;
- padding: 0;
- margin: 0;
- line-height: 1.5;
-
- &::after {
- border: none;
- }
- }
- image {
- width: 100rpx;
- height: 100rpx;
- margin-bottom: 20rpx;
- }
- text {
- font-size: 28rpx;
- color: #333;
- }
- }
- }
- }
- </style>
|