|
|
@@ -1,7 +1,10 @@
|
|
|
<template>
|
|
|
- <view class="goCode">
|
|
|
+ <view class="goCode" :class="[AppTheme]">
|
|
|
<view class="code">
|
|
|
- <image :src="code1" alt="" class="img" />
|
|
|
+ <image :src="code1" alt="" class="img" mode="widthFix"/>
|
|
|
+ </view>
|
|
|
+ <view class=" bcfxhb" @click="saveImg(code1)" :style="{'background-color': primary}">
|
|
|
+ 保存分享海报
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
@@ -33,6 +36,42 @@
|
|
|
this.$u.toast(ret.msg)
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ saveImg(url) {
|
|
|
+ const that = this;
|
|
|
+ console.log('url',url)
|
|
|
+ uni.downloadFile({
|
|
|
+ url: url,
|
|
|
+ success: res => {
|
|
|
+ if (res.statusCode === 200) {
|
|
|
+ uni.saveImageToPhotosAlbum({
|
|
|
+ filePath: res.tempFilePath,
|
|
|
+ success: function() {
|
|
|
+ uni.showToast({
|
|
|
+ title: '保存下载成功',
|
|
|
+ icon: 'none',
|
|
|
+ position: 'top'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail: function() {
|
|
|
+ uni.showToast({
|
|
|
+ title: '保存失败,请稍后重试',
|
|
|
+ icon: 'none',
|
|
|
+ position: 'top'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: '下载失败',
|
|
|
+ icon: 'none',
|
|
|
+ position: 'top'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
@@ -48,8 +87,21 @@
|
|
|
}
|
|
|
|
|
|
.code .img {
|
|
|
- position: fixed;
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
+ // position: fixed;
|
|
|
+ // width: 100%;
|
|
|
+ // height: 100%;
|
|
|
+ width: 690rpx;
|
|
|
+ display: block;
|
|
|
+ margin: auto;
|
|
|
+ border-radius: 20rpx;
|
|
|
+ }
|
|
|
+ .bcfxhb {
|
|
|
+ width: 550rpx;
|
|
|
+ height: 100rpx;
|
|
|
+ color: #fff;
|
|
|
+ border-radius: 50rpx;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 100rpx;
|
|
|
+ margin:20rpx auto;
|
|
|
}
|
|
|
</style>
|