<template>
	<view class="my-vita">
		<form @submit="formSubmit" >
			<view class="flex j-center" style="position: relative;">
				<textarea class="tex" v-model="vitas"  placeholder="请输入个人简介" />
				<text class="reset-tx" :style="{'color': t('color1')}"  @click="reset">重置</text>
			</view>
			<button class="set-btn" form-type="submit" :style="{background:'linear-gradient(90deg,'+t('color1')+' 0%,rgba('+t('color1rgb')+',0.8) 100%)'}">保 存</button>
		</form>
		
		<loading v-if="loading"></loading>
		<!-- 悬浮按钮 -->
		<drag-button></drag-button>
	</view>
</template>

<script>
	var app = getApp()
	export default {
		data() {
			
			return {
				vitas: '',
				pages: 1,
				loading:false,
			}
		},
		onLoad() {
			this.getdata()
		},

		methods: {
			formSubmit(e) {
				var formdata = e.detail.value;
				// console.log(this.vitas, e, 'tijiano-----')
				app.showLoading('提交中');
				app.post("ApiMy/setfield", {autograph:this.vitas}, data => {
				app.showLoading(false)
					if (data.status == 1) {
					  app.success(data.msg)
					  setTimeout(function () {
						app.goback(true)
					  }, 1000)
					} else {
					  app.error(data.msg)
					}
				})
			},
			getdata() {
				var that = this;
				that.loading = true;
				app.get('ApiMy/set', {}, data => {
					that.loading = false;
					that.vitas = data.userinfo.autograph;
					// that.loaded();
				});
			},
			
			reset() {
				this.vitas = ''
			}
		}
	}
</script>

<style lang="scss">
	.flex {display: flex;}
	.flex1 {flex: 1;}
	.j-center {justify-content: center;}
	.j-between {justify-content: space-between;}
	.j-around {justify-content: space-around;}
	.j-evenly {justify-content: space-evenly;}
	.flex-colum{flex-direction: column;}
	.al-item-center {align-items: center;}
	.fs12 {font-size: 24rpx;}

	.set-btn{width: 90%;margin:60rpx 5%;height:96rpx;line-height:96rpx;border-radius:48rpx;color:#FFFFFF;font-weight:bold;}
	.my-vita {
		padding: 20rpx;
		
		.tex {
			width: 100%;
			height: 230rpx;
			padding: 20rpx;
			border-radius: 10rpx;
			background-color: #FFF;
		}
		
		.reset-tx {
			position: absolute;
			bottom: 10rpx;
			right: 10rpx;
			z-index: 33;
		}
	}

</style>

