<template>
	<view>
		<view class="con">
			<mp-html :content="config.promote_info" :lazy-load="true" @imgtap="choose" v-if="config.promote_info"></mp-html>
			<block v-else>
			<image src="../static/promote/images/info_1.png" mode="widthFix"></image>
			<image src="../static/promote/images/info_2.png" mode="widthFix"></image>
			<image src="../static/promote/images/info_3.png" mode="widthFix"></image>
			</block>
		</view>
		<view class="bot">
			<view class="btn" @click="jumpUrl('')">马上申请</view>
		</view>
	</view>
</template>

<script>
	// promote/apply/apply.js
	// promote/team/team.js
	const app = getApp();
	const req = require("../../utils/request.js");
	import mpHtml from "../../components/mp-html/components/mp-html/mp-html";
	export default {
		components: {
			mpHtml
		},
		data() {
			return {
				isDistriUser: '',
				distribution: {},
				config: {}
			};
		},
		onShow() {
			this.getConfig();
			this.getmyinfo();
		},
		methods: {
			jump(url){
				uni.navigateTo({
					url: url
				})
			},
			jumpUrl(){
				if(this.isDistriUser == 1){
					this.jump('/promote/status/status')
				}else{
					if(this.distribution.distributionIsExamine == 1){
						this.jump('/promote/apply/apply')
					}else{
						uni.redirectTo({
							url: '/promote/apply/apply'
						})
					}
				}
			},
			getConfig(){
				req.g('/api/config', res => {
					this.config = res;
				})
			},
			getmyinfo: function() {
				let that = this;
				req.getRequest('/api/user/info', {}, data => {
					this.isDistriUser = data.isDistriUser;
					this.getdistri();
				});
			},
			getdistri() {
				req.postRequest('/api/distribution/config', {}, data => {
					this.distribution = data;
				})
			}
		}
	};
</script>

<style>
	@import "./info.css";
</style>
