<template>
	<view class="page">
		<navbar title="联系我们" leftClick @leftClick="$utils.navigateBack" />
		
		<view class="box">
			<view class=""
			v-if="configList.wx_image">
				<image :src="configList.wx_image" mode="aspectFill"></image>
				<view class="uni-color-btn"
				@click="saveImage(configList.wx_image)">
					保存二维码
				</view>
			</view>
			
			<view class=""
			v-if="configList.phone">
				全国联系电话：{{ configList.phone }}
				<view class="uni-color-btn"
				@click="confirm">
					拨打电话
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			// 拨打电话
			confirm() {
				uni.makePhoneCall({
					phoneNumber: this.configList.phone,
					success() {
						console.log('安卓拨打成功');
					},
					fail() {
						console.log('安卓拨打失败');
					}
				})
			},
			saveImage(image){
				/* 获取图片的信息 */
				uni.getImageInfo({
					src: image,
					success: function(image) {
						/* 保存图片到手机相册 */
						uni.saveImageToPhotosAlbum({
							filePath: image.path,
							success: function() {
								uni.showModal({
									title: '保存成功',
									content: '图片已成功保存到相册',
									showCancel: false
								});
							},
							complete(res) {
								console.log(res);
							}
						});
					}
				});
			},
		}
	}
</script>

<style scoped lang="scss">
.page{
	.box{
		display: flex;
		justify-content: center;
		align-items: center;
		height: 70vh;
		flex-direction: column;
		gap: 40rpx;
		image{
			width: 400rpx;
			height: 400rpx;
		}
	}
}
</style>
