zhengyiming
2025-06-09 f01e5949f44c74ce85f74e37658ad848036b6b12
apps/taro/src/subpackages/my/promotionQrcode/InnerPage.vue
@@ -3,23 +3,25 @@
    <div class="promotion-qrcode-content" :style="barStyle">
      <div
        class="promotion-qrcode-content-qrcode"
        :style="{ backgroundImage: `url(${OssAssets.common.PromotionQrcodeContentBG})` }"
        :style="{ backgroundImage: `url(${OssAssets.common.PromotionQrcodeCodeBG})` }"
      >
        <ShareQrcodeView :channles-num="userChannles[0]?.channlesNum" :size="148" />
        <div class="share-qrcode-view">
          <img v-if="link" :src="link" class="share-qrcode-view-img" />
        </div>
        <div class="promotion-qrcode-content-qrcode-tips">长按二维码分享好友</div>
      </div>
      <div class="promotion-qrcode-content-btn">点击下载二维码</div>
      <div class="promotion-qrcode-content-btn" @click="downloadQrcode">点击下载二维码</div>
    </div>
  </ContentView>
</template>
<script setup lang="ts">
import { ShareQrcodeView, ResultWithoutBG } from '@life-payment/components';
import { useLifeRechargeContext } from '@life-payment/core-vue';
import { isWeb } from '@/utils/env';
import Taro from '@tarojs/taro';
import { useSystemStore } from '@/stores/modules/system';
import { CSSProperties } from 'vue';
import { CSSProperties, useTemplateRef } from 'vue';
import { OssAssets } from '@/constants';
import { createQrCodeImg } from '@/components/Qrcode/utils/qrcode';
defineOptions({
  name: 'InnerPage',
@@ -28,16 +30,21 @@
// const { virtualUserInfo } = useUser();
const { blLifeRecharge } = useLifeRechargeContext();
const userChannles = computed(() =>
  (blLifeRecharge.accountModel.userChannles ?? []).filter(
    (x) => x.switchType !== blLifeRecharge.constants.LifePaySwitchTypeEnum.微信小程序
  )
);
const qrcodeRef = ref();
const channlesType = ref(userChannles.value[0]?.channlesNum ?? '');
const router = Taro.useRouter();
watch(userChannles, (val) => {
  channlesType.value = val?.[0]?.channlesNum ?? '';
const promoterIdNumber = router.params?.promoterIdNumber ?? '';
// const link = computed(
//   () =>
//     `${CLIENT_ORIGIN}/subpackages/my/AgentRecruitment/AgentRecruitment?promoterIdNumber=${promoterIdNumber}`
// );
const link = computed(() => {
  const url = `${CLIENT_ORIGIN}/subpackages/my/AgentRecruitment/AgentRecruitment?promoterIdNumber=${promoterIdNumber}`;
  return createQrCodeImg(url, {
    size: 300,
  });
});
const systemStore = useSystemStore();
@@ -49,6 +56,12 @@
      backgroundImage: `url(${OssAssets.common.PromotionQrcodeContentBG})`,
    } as CSSProperties)
);
function downloadQrcode() {
  Taro.saveImageToPhotosAlbum({
    filePath: link.value,
  });
}
</script>
<style lang="scss">
@@ -56,7 +69,7 @@
.promotion-qrcode-page-wrapper {
  .promotion-qrcode-content {
    margin-top: 480px;
    margin-top: 400px;
    width: 100%;
    height: 788px;
    background-size: 100% 100%;
@@ -68,11 +81,12 @@
  }
  .promotion-qrcode-content-qrcode {
    width: 432px;
    height: 432px;
    width: 440px;
    height: 438px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    position: relative;
@@ -103,8 +117,13 @@
  }
  .share-qrcode-view {
    margin-top: 60px;
    margin-top: -20px;
    padding: 0;
  }
  .share-qrcode-view-img {
    width: 300px;
    height: 300px;
  }
}
</style>