invitation_Haoyou.vue 2.1 KB
<template>
	<view>
		<u-navbar :back-icon-color="'#FFFFFF'" :is-back="true" title="邀请好友" :title-color="'#FFFFFF'" :background="background"></u-navbar>
		<view class="invitationContainer flex flexColumn justifyC alignC">
			<image :src="erweima" mode="widthFix" :show-menu-by-longpress="true"></image>
			<view class="invitationContainerText">保存图片</view>
		</view>
		<view class="invitationContainerButten" @click="getImage">保存相册</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			background: {
				// 渐变色
				backgroundImage: 'linear-gradient(135deg, rgba(255, 148, 48, 1) 0%, rgba(254, 206, 51, 1) 100%)'
			},
			erweima:'/static/evering/ic_18.png'
		};
	},
	methods: {
		getImage() {
			uni.showToast({
				icon: 'loading',
				title: '正在保存...'
			});
			uni.saveImageToPhotosAlbum({
				filePath: this.erweima,
				success: () => {
					console.log('保存成功');
					uni.showToast({
						icon: 'success',
						title: '保存成功'
					});
				},
				fail: () => {
					console.log('保存失败');
					uni.showToast({
						icon: 'error',
						title: '保存失败'
					});
				}
			});
		},
	}
};
</script>

<style>
page {
	width: 100%;
	height: 100%;
	background: linear-gradient(60deg, rgba(255, 148, 48, 1) 0%, rgba(254, 206, 51, 1) 100%);
	padding: 0 32rpx;
}
.invitationContainer {
	width: 686rpx;
	height: 830rpx;
	margin-top: 90rpx;
	background-image: url(https://s4.ax1x.com/2022/02/08/H15uwQ.png);
	background-size: cover;
}
.invitationContainer image {
	width: 338rpx;
	height: 338rpx;
}
.invitationContainerText {
	width: 128rpx;
	height: 32rpx;
	margin-top: 92rpx;
	color: rgba(0, 0, 0, 1);
	font-size: 32rpx;
	font-weight: 700;
	font-family: 'PingFang SC';
	text-align: left;
	line-height: 32rpx;
}
.invitationContainerButten {
	width: 456rpx;
	height: 88rpx;
	border-radius: 44rpx;
	opacity: 1;
	color: rgba(255, 149, 49, 1);
	font-size: 32rpx;
	font-weight: 700;
	font-family: 'PingFang SC';
	text-align: center;
	line-height: 88rpx;
	margin: 178rpx auto 0;
	background: linear-gradient(135deg, rgba(255, 227, 145, 1) 0%, rgba(255, 223, 124, 1) 100%);
}
</style>