zhengyiming
2025-06-10 e47c70d32e6fa7c9cb16ca19a79338ea36a83e94
apps/taro/src/subpackages/my/promotionQrcode/InnerPage.vue
@@ -1,22 +1,29 @@
<template>
  <ContentView>
    <!-- <div class="promotion-qrcode-content" :style="barStyle">
      <div class="promotion-qrcode-content-qrcode">
        <ShareQrcodeView :channles-num="userChannles[0]?.channlesNum" />
    <div class="promotion-qrcode-content" :style="barStyle">
      <div
        class="promotion-qrcode-content-qrcode"
        :style="{ backgroundImage: `url(${OssAssets.common.PromotionQrcodeCodeBG})` }"
      >
        <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> -->
    <ResultWithoutBG></ResultWithoutBG>
      <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';
import { downloadBase64File, Message } from '@/utils';
import { isInAlipay } from '@/utils/env';
defineOptions({
  name: 'InnerPage',
@@ -25,16 +32,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();
@@ -43,9 +55,21 @@
  () =>
    ({
      paddingTop: systemStore.info.statusBarHeight + 'px',
      // height: systemStore.navigationBarHeight + 'px',
      backgroundImage: `url(${OssAssets.common.PromotionQrcodeContentBG})`,
    } as CSSProperties)
);
function downloadQrcode() {
  // Taro.saveImageToPhotosAlbum({
  //   filePath: link.value,
  // });
  if (isInAlipay) {
    Message.warning('可在浏览器打开此网页下载文件。');
  } else {
    // TODO 还需要做小程序下载的兼容
    downloadBase64File(link.value, '推广二维码');
  }
}
</script>
<style lang="scss">
@@ -53,10 +77,9 @@
.promotion-qrcode-page-wrapper {
  .promotion-qrcode-content {
    margin-top: 306px;
    margin-top: 400px;
    width: 100%;
    height: 788px;
    background-image: url('https://renliyuan.oss-cn-hangzhou.aliyuncs.com/12333/lifePayment/assets/common/icon-promotion-qrcode-content-bg.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    display: flex;
@@ -66,22 +89,25 @@
  }
  .promotion-qrcode-content-qrcode {
    width: 432px;
    height: 432px;
    width: 440px;
    height: 438px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(180deg, #d4effe 0%, rgba(227, 251, 255, 0) 100%);
    border-radius: 44px 44px 44px 44px;
    border: 5px solid;
    border-image: linear-gradient(180deg, rgba(76, 198, 255, 1), rgba(241, 252, 255, 0)) 5 5;
    justify-content: center;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    position: relative;
  }
  .promotion-qrcode-content-qrcode-tips {
    margin-bottom: -22px;
    font-size: 32px;
    font-weight: bold;
    background: linear-gradient(0deg, #63654c 0%, #101f23 39%, #101f23 55%, #0082d3 100%);
    position: absolute;
    bottom: -22px;
    background: linear-gradient(0.25turn, #63654c 0%, #101f23 39%, #101f23 55%, #0082d3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  .promotion-qrcode-content-btn {
@@ -99,7 +125,13 @@
  }
  .share-qrcode-view {
    margin-top: -20px;
    padding: 0;
  }
  .share-qrcode-view-img {
    width: 300px;
    height: 300px;
  }
}
</style>