| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <template>
- <view class="default_page adffc" :style="{'height':h+'px', 'padding-top':mt+'px'}">
- <cus-header title='转发推荐'></cus-header>
- <div class="all adffc">
- <div class="box adffcac">
- <div class="box-code adffcac">
- <div class="box-code-ewm">
- <canvas canvas-id="qrcode" style="width:133px;height:133px; position: fixed;left: -9999px;top: -9999px;"></canvas>
- <image v-if="qrCodeDataURL" :src="qrCodeDataURL" mode="scaleToFill" show-menu-by-longpress></image>
- </div>
- </div>
- <div class="box-code-tip">扫码立即体验</div>
- <button class="share-btn" open-type="share">
- <image :src="imgBase+'btn_share.png'"></image>
- </button>
- </div>
- </div>
- </view>
- </template>
- <script>
- import { BaseApi } from '@/http/baseApi.js'
- import UQrcode from '@/uqrcode.js'
- export default {
- data(){
- return {
- imgBase:this.$imgBase,
- qrCodeDataURL:'',
- qrVal:'https://wxapp.transcend-intl.cn',
- }
- },
- onLoad() {
- this.generateQRCode();
- if(uni.getStorageSync('userInfo')){
- this.qrVal = `https://wxapp.transcend-intl.cn?shareUserId=${JSON.parse(uni.getStorageSync('userInfo'))?.id||''}`;
- }
- },
- methods:{
- onShareAppMessage(res) {
- const sharerId = JSON.parse(uni.getStorageSync('userInfo'))?.id||'';
- return {
- title: '致力于帮助企业打造高价值创造团队',
- path: `/pages/home?shareUserId=${sharerId}&shareType=Forward`,
- };
- },
- async generateQRCode(){
- try {
- let that = this;
- // 确保DOM已经更新,canvas元素已准备好
- this.$nextTick(() => {
- UQrcode.make({
- canvasId: 'qrcode',
- componentInstance: this,
- text: that.qrVal,
- size: 133,
- margin: 0,
- backgroundColor: '#ffffff',
- foregroundColor: '#000000',
- fileType: 'png',
- errorCorrectLevel: UQrcode.errorCorrectLevel.H,
- success: res => {
- uni.canvasToTempFilePath({
- canvasId: 'qrcode',
- fileType: 'png',
- quality: 1,
- success: (canvasRes) => {
- that.qrCodeDataURL = canvasRes.tempFilePath;
- },
- fail: (err) => {
- that.qrCodeDataURL = res;
- }
- }, this);
- }
- });
- });
- } catch { }
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .share-btn {
- width: 226rpx;
- height: 56rpx;
- background: linear-gradient( 180deg, #CFD9A4 0%, #029292 100%);
- border-radius: 28rpx;
- border: none;
- padding: 0;
- margin: 0;
- margin-top: 46rpx;
- line-height: inherit;
- &::after {
- border: none;
- }
- image{
- width: 100%;
- height: 100%;
- }
- }
-
- .default_page{
- box-sizing: border-box;
- .all{
- width: 100%;
- flex: 1;
- padding: 0 30rpx 62rpx;
- box-sizing: border-box;
- justify-content: flex-end;
- background: url('https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/forward_bg.png') no-repeat;
- background-size: 100% 100%;
- }
-
- .box{
- width: 100%;
- background: rgba(255,255,255,0.14);
- border-radius: 16rpx;
- padding: 36rpx 172rpx;
- box-sizing: border-box;
- &-code{
- background: #FFFFFF;
- border-radius: 16rpx;
- padding: 27rpx 40rpx;
- &-ewm{
- width: 133px;
- height: 133px;
- image{
- width: 100%;
- height: 100%;
- }
- }
- &-tip{
- font-family: PingFangSC, PingFang SC;
- font-weight: 600;
- font-size: 50rpx;
- color: #FFFFFF;
- line-height: 50rpx;
- letter-spacing: 2px;
- margin-top: 24rpx;
- }
- }
- }
- }
- </style>
|