<template>

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

		<view class="outer">
			<input class="input" type="text" @input="nameText" placeholder="请输入昵称" :value="data.userNickName"></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:{
					userNickName: "",
					sysUserInfoSid:""
					}			
			}
		},
		onLoad(options) {
			this.data.userNickName = options.userNickName
			this.data.sysUserInfoSid = options.sysUserInfoSid
			console.log('=======', options)
			console.log('=======', options.userNickName)
		},
		methods: {
			nameText(e) {
				this.data.userNickName = e.detail.value
			},
			save(){
				let _this = this
				
				_this.HTTP({
					url: 'aos/v1/aosUser/modifyUserNickName',
					method: 'PUT',
					paramsType: "FORM",
					data: {
						sysUserInfoSid: _this.data.sysUserInfoSid,
						userNickName: _this.data.userNickName
					},
					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>
