feat: 初始化
This commit is contained in:
55
pages/partner/downloadMoreSize/index.scss
Normal file
55
pages/partner/downloadMoreSize/index.scss
Normal file
@ -0,0 +1,55 @@
|
||||
.container {
|
||||
padding: 0 16px 24px;
|
||||
.swiper {
|
||||
margin: 14px 0 18px;
|
||||
}
|
||||
.title {
|
||||
margin: 14px 0 15px;
|
||||
}
|
||||
.shareLink {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
column-gap: 12px;
|
||||
height: 66px;
|
||||
box-shadow: 0px 2px 17px rgba(0, 0, 0, 0.09);
|
||||
}
|
||||
.shareCodeList {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
column-gap: 8px;
|
||||
row-gap: 14px;
|
||||
margin-top: 21px;
|
||||
.shareCard {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
row-gap: 4px;
|
||||
padding: 24px 24px 16px;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.15);
|
||||
.shareName {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
line-height: 26px;
|
||||
}
|
||||
.shareLink {
|
||||
margin-top: 16px;
|
||||
margin-bottom: 4px;
|
||||
word-break: break-all;
|
||||
font-size: 14px;
|
||||
}
|
||||
.btnWrapper {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
.download {
|
||||
column-gap: 5px;
|
||||
height: 30px;
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
83
pages/partner/downloadMoreSize/index.vue
Normal file
83
pages/partner/downloadMoreSize/index.vue
Normal file
@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<NavBar />
|
||||
<view class="container">
|
||||
<view class="title">
|
||||
<PageTitle :title="$t('menu.partner')" />
|
||||
</view>
|
||||
<view class="shareLink">
|
||||
{{ composeLink() }}
|
||||
<CopyIcon :value="composeLink()" :size="28" />
|
||||
</view>
|
||||
<view class="shareCodeList" v-if="shareCode">
|
||||
<view class="shareCard" v-for="(size, index) in codeSizes" :key="size">
|
||||
<text class="shareName">{{ $t('partner.promotionLink.size') }}{{ index + 1 }}</text>
|
||||
<view class="shareCodeContent">
|
||||
<l-qrcode :ref="`size_${size}`" :value="shareCode" :size="size" :marginSize="1" bgColor="#fff" />
|
||||
</view>
|
||||
<view class="btnWrapper">
|
||||
<button class="primaryButton download" @click="() => downLoadQRCode(size)">
|
||||
<image src="/static/partner/download.png" mode="aspectFit" style="width: 16px; height: 16px"></image>
|
||||
{{ $t('common.download') }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
shareCode: undefined,
|
||||
codeSizes: [80, 91, 106, 119]
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
composeLink() {
|
||||
if (this.shareCode) {
|
||||
return `http://47.238.103.157:81/${this.shareCode}`;
|
||||
}
|
||||
},
|
||||
downLoadQRCode(size) {
|
||||
const el = this.$refs[`size_${size}`][0];
|
||||
el.canvasToTempFilePath({
|
||||
success: (res) => {
|
||||
this.image = res.tempFilePath;
|
||||
console.log('res.tempFilePath==>', res.tempFilePath);
|
||||
// #ifdef H5
|
||||
var oA = document.createElement('a');
|
||||
oA.download = `${this.shareCode}_${size}x${size}`;
|
||||
oA.href = res.tempFilePath;
|
||||
document.body.appendChild(oA);
|
||||
oA.click();
|
||||
oA.remove();
|
||||
// #endif
|
||||
|
||||
// #ifndef H5
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: res.tempFilePath,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: this.$t('common.success.saveDone'),
|
||||
});
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
fail(err) {
|
||||
console.log('err:::', err);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
onLoad(params) {
|
||||
this.shareCode = params.shareCode;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './index.scss';
|
||||
</style>
|
Reference in New Issue
Block a user