<template>
	<view class="">
		获取人脸
		<img :src="pic" alt="">
	</view>
</template>

<script>
	export default {
		data() {
			return {
				msg: {
					deviceId: "b44f96f00ff0",
				},

				pic: '',
				gatewayDeviceId: 'd825b0036120',
			}
		},
		methods: {
			// 重置设备
			async resetDevice() {
				uni.showLoading({
					mask: true,
					icon: 'none',
					title: '正在重置设备',
				})
				let {
					data: res
				} = await uni.$http.post('/api/v1/test/bluetooth/resetDevice', this.msg)
				console.log(res);
				uni.hideLoading()
				if (res.code == 200) {
					this.$u.toast(`重置成功`)
				} else {
					this.$u.toast(`重置失败`)
				}
			},
			async getFacePic() {
				let {
					data: res
				} = await uni.$http.get(`/api/v1/test/user/facePic/${1}`)
				console.log(res.data);
				this.pic = 'data:image/jpg;base64,' + res.data
			},
			async gate() {
				const {
					data: res
				} = await uni.$http.get(
					`/api/v1/test/gateway/connection/${this.gatewayDeviceId}`)
				console.log(res);


			}
		},
		onLoad() {
			// this.resetDevice()
			// this.getFacePic()
			// this.gate()
			uni.showToast({
				title: '我在测试',
				duration: 10000,
			})
			setInterval(() => {
				uni.showToast({
					title: '2我在测试',
					duration: 10000,
				})
			}, 10000)

		}
	}
</script>