<template>
|
<ContentView>
|
<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" @click="downloadQrcode">点击下载二维码</div>
|
</div>
|
</ContentView>
|
</template>
|
|
<script setup lang="ts">
|
import { useLifeRechargeContext } from '@life-payment/core-vue';
|
import Taro from '@tarojs/taro';
|
import { useSystemStore } from '@/stores/modules/system';
|
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',
|
});
|
|
// const { virtualUserInfo } = useUser();
|
const { blLifeRecharge } = useLifeRechargeContext();
|
|
const qrcodeRef = ref();
|
|
const router = Taro.useRouter();
|
|
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();
|
|
const barStyle = computed(
|
() =>
|
({
|
paddingTop: systemStore.info.statusBarHeight + '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">
|
@import '@/styles/common.scss';
|
|
.promotion-qrcode-page-wrapper {
|
.promotion-qrcode-content {
|
margin-top: 400px;
|
width: 100%;
|
height: 788px;
|
background-size: 100% 100%;
|
background-repeat: no-repeat;
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: center;
|
}
|
|
.promotion-qrcode-content-qrcode {
|
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;
|
}
|
|
.promotion-qrcode-content-qrcode-tips {
|
font-size: 32px;
|
font-weight: bold;
|
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 {
|
width: 432px;
|
height: 96px;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
background-color: boleGetCssVar('color', 'primary');
|
margin-top: 70px;
|
border-radius: 12px;
|
font-size: 38px;
|
font-weight: 500;
|
color: #ffffff;
|
}
|
|
.share-qrcode-view {
|
margin-top: -20px;
|
padding: 0;
|
}
|
|
.share-qrcode-view-img {
|
width: 300px;
|
height: 300px;
|
}
|
}
|
</style>
|