<template>
	<view class="container">
		<uni-nav-bar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
			@clickLeft="toBack">
			<view class="nav-title">
				<text>{{title}}</text>
			</view>
		</uni-nav-bar>
		<view class="page-body">
			<uni-card :title="warnName">
				<image style="width: 100%;" :src="toQr" mode="widthFix"></image>
			</uni-card>
		</view>
	</view>
</template>
<script>
	import http from '@/http/api.js';
	import {
		oss
	} from '@/common/setting';
	export default {
		components: {

		},
		data() {
			return {
				title: '预警响应二维码',
				warnName: '',
				warnId: '',
				baseOSS: '',
				qrImageUrl: '',
			}
		},
		computed: {
			toQr() {
				if (this.qrImageUrl != undefined && this.qrImageUrl.length > 0) {
					let url = this.baseOSS + this.qrImageUrl;
					return url;
				} else {
					return '';
				}
			},
		},
		onLoad(options) {
			this.baseOSS = oss;
			this.warnId = options.id;
			let that = this;
			let postData = {};
			postData['id'] = this.warnId;
			http.request({
				url: '/galaxy-business/yj/warn/detail',
				method: 'GET',
				data: postData
			}).then(res => {
				if (res.data != null) {
					that.qrImageUrl = res.data.warnQrUrl;
					that.warnName = res.data.warnName;
				}
			}).catch(err => {
				console.log(err)
			})
		},
		onShow() {

		},
		methods: {
			toOss(path) {
				let url = this.baseOSS + path;
				return url;
			},
			toBack() {
				uni.navigateBack({
					delta: 1
				})
			},
		}
	}
</script>

<style>

</style>