Commit d26e7519 authored by Facius's avatar Facius

feat:名片保存

parent 02705b63
Pipeline #3071 canceled with stages
...@@ -80,12 +80,18 @@ ...@@ -80,12 +80,18 @@
</view> </view>
</template> </template>
<l-painter <l-painter
:board="poster" :board="posterSave"
isCanvasToTempFilePath isCanvasToTempFilePath
@success="handleCanvasSuccess" @success="handleCanvasSuccessSave"
custom-style="position: fixed; left: 200%" custom-style="position: fixed; left: 200%"
/> />
<QRCodeView :url="shareUrl" @canvas="handleCanvas" /> <l-painter
:board="posterShare"
isCanvasToTempFilePath
@success="handleCanvasSuccessShare"
custom-style="position: fixed; right: 200%"
/>
<QRCodeView :url="codeShareUrl" @canvas="handleCanvas" />
<u-toast ref="uToast" /> <u-toast ref="uToast" />
</view> </view>
</template> </template>
...@@ -112,10 +118,10 @@ export default { ...@@ -112,10 +118,10 @@ export default {
size: 60, size: 60,
img: '', img: '',
codeUrl: '', codeUrl: '',
poster: {}, posterShare: {},
posterSave: {},
saveUrl: '', saveUrl: '',
currentBlock: () => {}, currentBlock: () => {},
type: 'share',
} }
}, },
computed: { computed: {
...@@ -131,7 +137,7 @@ export default { ...@@ -131,7 +137,7 @@ export default {
isBlack() { isBlack() {
return this.info.coverUrl == 'black' return this.info.coverUrl == 'black'
}, },
shareUrl() { codeShareUrl() {
return card_share_url + `?cardId=${this.info.id}` return card_share_url + `?cardId=${this.info.id}`
}, },
// green 绿;blue 蓝;black 黑; // green 绿;blue 蓝;black 黑;
...@@ -154,8 +160,7 @@ export default { ...@@ -154,8 +160,7 @@ export default {
} }
} }
}, },
currentPoster() { currentPosterSave() {
if (this.isSave) {
switch (this.info.coverUrl) { switch (this.info.coverUrl) {
case 'green': case 'green':
return { return {
...@@ -277,7 +282,7 @@ export default { ...@@ -277,7 +282,7 @@ export default {
}, },
{ {
type: 'qrcode', type: 'qrcode',
text: this.shareUrl, text: this.codeShareUrl,
css: { css: {
position: 'absolute', position: 'absolute',
width: '120rpx', width: '120rpx',
...@@ -411,7 +416,7 @@ export default { ...@@ -411,7 +416,7 @@ export default {
}, },
{ {
type: 'qrcode', type: 'qrcode',
text: this.shareUrl, text: this.codeShareUrl,
css: { css: {
position: 'absolute', position: 'absolute',
width: '120rpx', width: '120rpx',
...@@ -519,7 +524,7 @@ export default { ...@@ -519,7 +524,7 @@ export default {
}, },
{ {
type: 'qrcode', type: 'qrcode',
text: this.shareUrl, text: this.codeShareUrl,
css: { css: {
position: 'absolute', position: 'absolute',
width: '120rpx', width: '120rpx',
...@@ -562,7 +567,8 @@ export default { ...@@ -562,7 +567,8 @@ export default {
], ],
} }
} }
} else if (this.isShare) { },
currentPosterShare() {
switch (this.info.coverUrl) { switch (this.info.coverUrl) {
case 'green': case 'green':
return { return {
...@@ -697,7 +703,7 @@ export default { ...@@ -697,7 +703,7 @@ export default {
}, },
{ {
type: 'qrcode', type: 'qrcode',
text: this.shareUrl, text: this.codeShareUrl,
css: { css: {
position: 'absolute', position: 'absolute',
width: '120rpx', width: '120rpx',
...@@ -845,7 +851,7 @@ export default { ...@@ -845,7 +851,7 @@ export default {
}, },
{ {
type: 'qrcode', type: 'qrcode',
text: this.shareUrl, text: this.codeShareUrl,
css: { css: {
position: 'absolute', position: 'absolute',
width: '120rpx', width: '120rpx',
...@@ -968,7 +974,7 @@ export default { ...@@ -968,7 +974,7 @@ export default {
}, },
{ {
type: 'qrcode', type: 'qrcode',
text: this.shareUrl, text: this.codeShareUrl,
css: { css: {
position: 'absolute', position: 'absolute',
width: '120rpx', width: '120rpx',
...@@ -1013,7 +1019,6 @@ export default { ...@@ -1013,7 +1019,6 @@ export default {
], ],
} }
} }
}
}, },
isSave() { isSave() {
return this.type == 'save' return this.type == 'save'
...@@ -1029,14 +1034,14 @@ export default { ...@@ -1029,14 +1034,14 @@ export default {
handleCanvas(url) { handleCanvas(url) {
this.codeUrl = url this.codeUrl = url
}, },
handleCanvasSuccess(url) { handleCanvasSuccessShare(url) {
if (this.isSave) { this.$emit('update', url)
this.saveUrl = url },
} handleCanvasSuccessSave(url) {
this.saveUrl = url
this.currentBlock(url) this.currentBlock(url)
}, },
saveImage(type = 'save') { saveImage(type = 'save') {
this.type = type
this.currentBlock = (url) => { this.currentBlock = (url) => {
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath: url, filePath: url,
...@@ -1068,16 +1073,12 @@ export default { ...@@ -1068,16 +1073,12 @@ export default {
if (this.saveUrl) { if (this.saveUrl) {
this.currentBlock(this.saveUrl) this.currentBlock(this.saveUrl)
} else { } else {
console.log('------currentPoster-------', this.currentPoster) this.posterSave = this.currentPosterSave
this.poster = this.currentPoster
} }
}, },
updateImage(type = 'share') { updateImage() {
this.type = type console.log('----updateImage-------')
this.currentBlock = (url) => { this.posterShare = this.currentPosterShare
this.$emit('update', url)
}
this.poster = this.currentPoster
}, },
}, },
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment