|
@@ -46,9 +46,14 @@
|
|
<view class="shareQrCodePopupContent">
|
|
<view class="shareQrCodePopupContent">
|
|
<view class="color-primary text">邀请用户注册领50积分</view>
|
|
<view class="color-primary text">邀请用户注册领50积分</view>
|
|
<view class="qrCode">
|
|
<view class="qrCode">
|
|
- <image :src="shareUrl" style="width: 200px;height: 200px;"></image>
|
|
|
|
|
|
+ <image
|
|
|
|
+ v-if="!!shareUrl"
|
|
|
|
+ :src="shareUrl"
|
|
|
|
+ :show-menu-by-longpress="true"
|
|
|
|
+ style="width: 200px;height: 200px; padding: 20rpx;"
|
|
|
|
+ ></image>
|
|
</view>
|
|
</view>
|
|
- <!-- <button v-if="shareUrl" class="send-button ss-m-b-30" @tap="handleSaveShareUrl">保存</button> -->
|
|
|
|
|
|
+ <view v-if="shareUrl" class="saveImg">长按二维码保存图片</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
</uni-popup>
|
|
</view>
|
|
</view>
|
|
@@ -134,12 +139,16 @@ const shareUrl = ref()
|
|
// 生成分享二维码
|
|
// 生成分享二维码
|
|
const handleShareCode = async () => {
|
|
const handleShareCode = async () => {
|
|
const userId = useUserStore?.accountInfo?.userId || ''
|
|
const userId = useUserStore?.accountInfo?.userId || ''
|
|
|
|
+ console.log(1, 'userId', userId)
|
|
if (!userId) {
|
|
if (!userId) {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title: '请先登录',
|
|
title: '请先登录',
|
|
icon: 'none'
|
|
icon: 'none'
|
|
})
|
|
})
|
|
|
|
+ showAuthModal()
|
|
|
|
+ return
|
|
}
|
|
}
|
|
|
|
+ // if (!getAccessToken())
|
|
const query = {
|
|
const query = {
|
|
scene: 'shareId=' + userId,
|
|
scene: 'shareId=' + userId,
|
|
path: 'pages/login/index',
|
|
path: 'pages/login/index',
|
|
@@ -155,7 +164,32 @@ const handleShareCode = async () => {
|
|
|
|
|
|
// 保存到本地
|
|
// 保存到本地
|
|
const handleSaveShareUrl = async () => {
|
|
const handleSaveShareUrl = async () => {
|
|
- const convertData = await base64src(shareUrl.value, '我的分享码')
|
|
|
|
|
|
+ // base64src(shareUrl.value, '我的分享码')
|
|
|
|
+ const fsm = wx.getFileSystemManager()
|
|
|
|
+ const data = shareUrl.value
|
|
|
|
+ // console.log('data:', data)
|
|
|
|
+ if (!data) return
|
|
|
|
+ fsm.writeFile({
|
|
|
|
+ filePath:wx.env.USER_DATA_PATH+'/MySharingCode.png',
|
|
|
|
+ data: data.slice(22),
|
|
|
|
+ encoding:'base64',
|
|
|
|
+ success: res => {
|
|
|
|
+ wx.saveImageToPhotosAlbum({
|
|
|
|
+ filePath: wx.env.USER_DATA_PATH + '/MySharingCode.png',
|
|
|
|
+ success: function (res) {
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: '保存成功',
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ fail: function (err) {
|
|
|
|
+ console.log(err)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ // console.log(res)
|
|
|
|
+ }, fail: err => {
|
|
|
|
+ console.log(err)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
// 登录
|
|
// 登录
|
|
@@ -223,11 +257,9 @@ const handleLogoutConfirm = () => {
|
|
margin: 0 0 20rpx 30rpx;
|
|
margin: 0 0 20rpx 30rpx;
|
|
}
|
|
}
|
|
.shareQrCodePopupContent {
|
|
.shareQrCodePopupContent {
|
|
- // width: 80vw;
|
|
|
|
- // display: flex;
|
|
|
|
- // flex-direction: column;
|
|
|
|
- margin: 50rpx;
|
|
|
|
- padding: 50rpx;
|
|
|
|
|
|
+ width: 80vw;
|
|
|
|
+ padding: 30rpx;
|
|
|
|
+ margin-bottom: 20rpx;
|
|
text-align: center;
|
|
text-align: center;
|
|
background-color: #fff;
|
|
background-color: #fff;
|
|
.text {
|
|
.text {
|
|
@@ -236,5 +268,10 @@ const handleLogoutConfirm = () => {
|
|
.qrCode {
|
|
.qrCode {
|
|
margin-left: 4px;
|
|
margin-left: 4px;
|
|
}
|
|
}
|
|
|
|
+ .saveImg {
|
|
|
|
+ text-align: center;
|
|
|
|
+ margin-top: 10px;
|
|
|
|
+ color: #999;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|