<template>
	<view class="container">
		<navBar title="图片预览" :back="true" color="#333333" background="#FFFFFF" />

		<!-- <web-view :src="url1"></web-view> -->

		<image :src="url1" mode="widthFix" show-menu-by-longpress></image>


		<!-- <u-modal :show="show" title="温馨提示" confirmText="我知道了" content="" @confirm="confirm">
			<view class="slot-content">
				如要保存,请长按图片以保存至手机相册
			</view>
		</u-modal> -->

		<view class="btnBox">
			<view class="btn" @click="toSave">
				保存到手机相册
			</view>
		</view>
	</view>
</template>

<script>
	// import navBar from '@/components/navBar/index.vue'

	// import {
	// 	getKefu,
	// } from '@/api/index/index.js'
	export default {
		// components: {
		// 	navBar
		// },
		data() {
			return {
				url1: '',
				show: false
			}
		},
		onLoad(o) {
			// this.getabout()
			this.url1 = o.url
			setTimeout(() => {
				this.show = true
			}, 1000)
		},
		methods: {
			toSave() {
				wx.showShareImageMenu({
					path: this.url1,
					success: (r) => {
						console.log('r--------------', r);

						uni.showToast({
							title: '操作成功',
							icon: 'success'
						})
					}
				})

				// wx.saveImageToPhotosAlbum({
				// 	filePath: this.url1,
				// 	success: (res) => {
				// 		wx.showToast({
				// 			title: '保存成功',
				// 			icon: 'success'
				// 		})
				// 	}
				// })
			},

			confirm() {
				this.show = false
			},
			// async getabout() {
			// 	let res1 = await getKefu()
			// 	console.log('关于我们返回值--------2', res1);
			// 	if (res1.code == 0) {
			// 		this.content = res1.data.about.value
			// 	} else {
			// 		this.$toast(res1.message)
			// 	}
			// },
			// toProtocol(type) {
			// 	uni.navigateTo({
			// 		url: '/pages/my/protocol/index?type=' + type
			// 	})
			// }
		}
	}
</script>

<style lang="scss" scoped>
	@import "./index.scss";
</style>