Files
frontend-app/pages/invite_friends/invite_friends.vue
T

125 lines
3.2 KiB
Vue
Raw Normal View History

2025-03-20 08:46:07 +08:00
<template>
<view class="invite_friends_warp">
2025-05-07 09:54:33 +08:00
<!-- <view class="invite_img">
2025-03-20 08:46:07 +08:00
<view class="invite_content_img">
<view>
<view class="invite_content_img_title">邀请你</view>
<view class="invite_content_img_msg">扫一扫,好物轻松购</view>
</view>
<view>
<up-image src="/static/invite/bg.png" width="60" height="60" bgColor="#f1f6ff00"></up-image>
</view>
</view>
2025-05-07 09:54:33 +08:00
</view> -->
<view class="invite_img">
<up-image src="/static/invite/bg.png" width="100%" height="460" bgColor="#f1f6ff00" shape="square" radius=10></up-image>
2025-03-20 08:46:07 +08:00
</view>
<view class="invite_but">
<view class="save_but">
2025-05-07 09:54:33 +08:00
<text style="margin-left: 10rpx;" @click="saveBaseImgFile">保存图片</text>
2025-03-20 08:46:07 +08:00
</view>
</view>
2025-05-07 09:54:33 +08:00
<up-toast ref="uToastRef"></up-toast>
2025-03-20 08:46:07 +08:00
</view>
</template>
<script>
2025-05-07 09:54:33 +08:00
import { base64 } from '@/utils/inviteBase64.js';
2025-03-20 08:46:07 +08:00
export default {
data() {
return {
}
},
methods: {
// 保存图片
// async saveImage(){
// const shareImagesObj = this.shareImagesArr[this.shareImagesIndex];
// const params = {
// id:this.shareId,
// imgId:shareImagesObj.id,
// }
// const response = await uni.$httpHeader.post(mergeImage,params);
// this.saveHeadImgFile(response.data);
// },
2025-05-07 09:54:33 +08:00
saveBaseImgFile() {
uni.showLoading({
title: '保存中...',
})
const currentBase64 = base64;
const bitmap = new plus.nativeObj.Bitmap('base64')
bitmap.loadBase64Data(currentBase64, () => {
const url = '_doc/' + new Date().getTime() + '.png'
bitmap.save(
url,
{
overwrite: false, // 是否覆盖
// quality: 'quality' // 图片清晰度
},
(i) => {
uni.saveImageToPhotosAlbum({
filePath: url,
success: () => {
uni.hideLoading();
this.$refs.uToastRef.show({
type: 'success',
message: "图片保存到相册成功",
});
bitmap.clear()
}
})
},
(e) => {
uni.hideLoading();
console.log('图片保存失败',e)
this.$refs.uToastRef.show({
type: 'error',
message: "图片保存失败",
});
bitmap.clear()
}
)
},
(e) => {
uni.hideLoading();
console.log('图片保存失败',e)
this.$refs.uToastRef.show({
type: 'error',
message: "图片保存失败",
});
bitmap.clear()
}
)
}
2025-03-20 08:46:07 +08:00
}
}
</script>
<style lang="scss" scoped>
.invite_friends_warp{
height: calc(100vh - 80rpx);
padding: 40rpx;
}
.invite_img{
margin-top: 52rpx;
height: 930rpx;
}
.invite_but{
padding: 20rpx 50rpx;
margin-top: 52rpx;
.save_but{
text-align: center;
background: $app-bt-bj;
border-radius: 45rpx;
width: 100%;
color: #FFF;
padding: 30rpx 0;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
}
}
</style>