<template>
	<view :style="'background-color: '+theme.bg+';color: '+theme.text">
		<myNav :title="i18n.newWord.application"></myNav>

		<view class="listBox">
			<view class="width-100b height-96 line-height-96">
				<text class="font-30 bold-font">{{i18n.newWord.xiangmu}}</text>
			</view>
			<view class="width-100b height-96">
				<input class="width-100b height-96 font-30" type="text" v-model="project_name"
					:placeholder="i18n.newWord.xiangmu_input" />
			</view>
		</view>

		<view class="listBox">
			<view class="width-100b height-96 line-height-96">
				<text class="font-30 bold-font">{{i18n.newWord.desc}}</text>
			</view>
			<view class="width-100b height-96">
				<input class="width-100b height-96 font-30" type="text" v-model="describe"
					:placeholder="i18n.newWord.desc_input" />
			</view>
		</view>

		<view class="listBox">
			<view class="width-100b height-96 line-height-96">
				<text class="font-30 bold-font">{{i18n.newWord.faxin_num}}</text>
			</view>
			<view class="width-100b height-96">
				<input class="width-100b height-96 font-30 nummedium-font" type="number" v-model="amount"
					:placeholder="i18n.newWord.faxin_num_input" />
			</view>
		</view>

		<view class="listBox">
			<view class="width-100b height-96 line-height-96">
				<text class="font-30 bold-font">{{i18n.newWord.web_url}}</text>
			</view>
			<view class="width-100b height-96">
				<input class="width-100b height-96 font-30 nummedium-font" type="text"
					v-model="official_web" :placeholder="i18n.newWord.web_url_input" />
			</view>
		</view>

		<view class="listBox">
			<view class="width-100b height-96 line-height-96">
				<text class="font-30 bold-font">{{i18n.newWord.white_paper}}</text>
			</view>
			<view class="width-100b height-96">
				<input class="width-100b height-96 font-30 nummedium-font" type="text" v-model="white_book"
					:placeholder="i18n.newWord.white_paper_input" />
			</view>
		</view>

		<view class="listBox">
			<view class="width-100b height-96 line-height-96">
				<text class="font-30 bold-font">{{i18n.newWord.qun}}</text>
			</view>
			<view class="width-100b height-96">
				<input class="width-100b height-96 font-30 nummedium-font" type="text" v-model="community"
					:placeholder="i18n.newWord.qun_input" />
			</view>
		</view>
		<view class="listBox">
			<view class="width-100b height-96 line-height-96">
				<text class="font-30 bold-font">{{i18n.newWord.email}}</text>
			</view>
			<view class="width-100b height-96">
				<input class="width-100b height-96 font-30 nummedium-font" type="text" v-model="mailbox"
					:placeholder="i18n.newWord.email_input" />
			</view>
		</view>
		<view class="listBox">
			<view class="width-100b height-96 line-height-96">
				<text class="font-30 bold-font">{{i18n.newWord.jianjie}}</text>
			</view>
			<view class="width-100b padding-b-20">
				<textarea class="width-100b height-200 font-30" v-model="intro" :placeholder="i18n.newWord.jianjie_input"/>
			</view>
		</view>
		<view class="width-100b flex align-center justify-center margin-t-100 padding-b-60">
			<button @click="real" class="cu-btn loginBtn">{{i18n.mine.safety.tijiao}}</button>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				project_name: '', //项目名称
				describe: '', //智能链接描述
				intro: '', //简介
				amount: '', //发行量
				official_web: '', //官网
				white_book: '', //白皮书
				community: '', //社群
				mailbox: '', //联系方式（邮箱）

				flag: true,
				theme:''
			}
		},
		computed: {
			i18n() {
				return this.$t('message');
			},
		},
		onShow() {
			if (uni.getStorageSync("theme") == "dark") {
				this.theme = this.$store.state.darkTheme
			} else {
				this.theme = this.$store.state.lightTheme
			}
		},
		methods: {
			real() {
				if (!this.flag) return
				if (this.project_name == '') {
					this.tos(this.i18n.newWord.xiangmu_input)
					return
				}
				if (this.describe == '') {
					this.tos(this.i18n.newWord.desc_input)
					return
				}
				if (this.amount == '') {
					this.tos(this.i18n.newWord.faxin_num_input)
					return
				}
				if (this.official_web == '') {
					this.tos(this.i18n.newWord.web_url_input)
					return
				}
				if (this.white_book == '') {
					this.tos(this.i18n.newWord.white_paper_input)
					return
				}
				if (this.community == '') {
					this.tos(this.i18n.newWord.qun_input)
					return
				}
				if (this.mailbox == '') {
					this.tos(this.i18n.newWord.email_input)
					return
				}
				if (this.intro == '') {
					this.tos(this.i18n.newWord.jianjie_input)
					return
				}
				this.flag = false
				this.post('/index/curr_apply', {
					title: this.project_name,
					desc: this.describe,
					faxin_num: this.amount,
					web_url: this.official_web,
					white_paper: this.white_book,
					qun: this.community,
					email: this.mailbox,
					jianjie: this.intro,
				}, true).then(res => {
					this.flag = true
					console.log('上币申请', res)
					if (res.code == 1) {
						this.tos(res.msg)
						setTimeout(() => {
							uni.navigateBack({
								delta: 1
							})
						}, 500)
					}
				})
			}

		}
	}
</script>

<style>
	.listBox {
		width: 100%;
		/* height: 96rpx; */
		padding: 0 45rpx;
		margin-bottom: 1rpx;
		/* background-color: #FFFFFF; */
	}

	.loginBtn {
		width: 600rpx;
		height: 96rpx;
		background: #0165EE !important;
		border-radius: 12rpx;
		line-height: 96rpx;
		color: #FFFFFF;
		font-size: 32rpx;
		text-align: center;
	}
</style>
