<template>

	<RefreshView ref="mescrollRef" :hasBack="true" text="修改姓名" :useDownScroll="false" :useUpScroll="false">

		<view class="outer">
			<input class="input" type="text" @input="nameText" placeholder="请输入姓名" :value="data.realName"></input>
			<view style="height: 5rpx;width: 100%;background-color: #eee;margin-top: 28rpx;"></view>
			<text class="bottom">注：姓名每个月只能修改一次。</text>
		</view>
		
		<text class="btn" @click="save()">保存</text>

	</RefreshView>

</template>

<script>
	export default {
		data() {
			return {
				data:{
					realName: "",
					sysUserInfoSid:""
				}
			}
		},
		onLoad(options) {
			this.data.realName = options.realName
			this.data.sysUserInfoSid = options.sysUserInfoSid
			console.log('=======', options)
			console.log('=======', options.realName)
		},
		methods: {
			nameText(e) {
				this.data.realName = e.detail.value
			},
			save(){
				let _this = this
				_this.HTTP({
					url: 'aos/v1/aosUser/modifyRealName',
					method: 'PUT',
					paramsType: "FORM",
					data: {
						sysUserInfoSid:  _this.data.sysUserInfoSid,
						realName: _this.data.realName,
					},
					toast: true,
					loading: true
				}).then((res) => {
					console.log('=======', res)
					// 保存
					uni.navigateBack({
						delta: 1
					})
				});
			}
		}
	}
</script>

<style lang="scss">
	.outer {
		display: flex;
		margin-top: 20rpx;
		flex-direction: column;
		padding: 20rpx;

		.input {
			font-size: 32rpx;
			color: #101010;
			font-weight: 600;
			font-family: sans-serif;
		}

		.bottom {
			margin-top: 30rpx;
			font-size: 28rpx;
			color: #999;
		}
	}
	.btn {
		justify-content: center;
		width: 100%;
		display: flex;
		margin-top: 20rpx;
		padding: 30rpx;
		font-size: 28rpx;
		color: #FFFFFF;
		background: #007AFF;
		text-align: center;
	}
</style>
