index.vue 7.18 KB
<template>
	<!-- 悄悄话-->
	<view class="page">
		<view class="content">
			<view class="titleall-left">
				<view class="titleall-left-line"></view>我的悄悄话
			</view>
			<view class="message-list">
				<view class="info-box">
					<view class="info-box-list">
						<view class="serve">
							<view class="serve-title">姓名</view>
							<view>
								<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;"
									v-model="form.name" placeholder="请输入" style="text-align: right;" />
							</view>
						</view>
					</view>
				</view>
				<view class="info-box">
					<view class="info-box-list">
						<view class="serve">
							<view class="serve-title">性别</view>
							<view class="serve-right">
								<picker @change="bindPickerChangeSex" :value="index" :range="sexArray">
									<view class="uni-input">{{form.sex?sexArray[form.sex]:'请选择'}}</view>
								</picker>
								<image src="../../static/down3.png"></image>
							</view>
						</view>
					</view>
				</view>
				<view class="info-box">
					<view class="info-box-list">
						<view class="serve">
							<view class="serve-title">年龄</view>
							<view>
								<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;"
									v-model="form.age" placeholder="请输入" style="text-align: right;" />
							</view>
						</view>
					</view>
				</view>
				<view class="info-box">
					<view class="info-box-list">
						<view class="serve">
							<view class="serve-title">学历</view>
							<view>
								<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;"
									v-model="form.degree" placeholder="请输入" style="text-align: right;" />
							</view>
						</view>
					</view>
				</view>
				<view class="info-box">
					<view class="info-box-list">
						<view class="serve">
							<view class="serve-title">就读学校</view>
							<view>
								<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;"
									v-model="form.attendSchool" placeholder="请输入" style="text-align: right;" />
							</view>
						</view>
					</view>
				</view>
				<view class="info-box">
					<view class="info-box-list">
						<view>
							<view class="serve-title" style="font-size: 25rpx;color: #909090;">内容</view>
							<textarea v-model="form.content" placeholder="请输入"
								placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;"
								style="margin-top: 20rpx;"></textarea>
							<view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="page-footer">
				<view class="footer-buy">
					<view class="cart-add" @click="register">
						<image src="../../static/btn5.png"></image>
						<text>提交</text>
					</view>
				</view>
			</view>

		</view>
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					name: "",
					sex: "",
					age: "",
					degree: "",
					attend_school: "",
					content: ""
				},
				// 性别下拉框
				sexArray: ['男', '女'],
				index: 0,
			};
		},
		created() {},
		methods: {
			// 选择性别
			bindPickerChangeSex: function(e) {
				console.log('picker发送选择改变,携带值为', e)
				this.form.sex = e.detail.value;
			},
			register() {
				this.API.addInfo(this.form).then(res => {
					console.log(res)
					if (res.code == 200) {
						uni.showToast({
							icon: 'success',
							title: '提交成功'
						})
						setTimeout(() => {
							uni.redirectTo({
								url: '/pages/whisper/whisperSuccess',
							})
						}, 800)
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.listBox {
		position: relative;
		z-index: 1;
	}

	.content {
		width: 100%;
		padding-bottom: 120rpx;
	}

	.titleall-left {
		font-size: 32rpx;
		font-weight: bold;
		display: flex;
		align-items: center;
		margin: 30rpx;

		.titleall-left-line {
			width: 16rpx;
			height: 36rpx;
			border-radius: 100rpx;
			background-color: #5D76F4;
			margin-right: 20rpx;
		}
	}

	.top-box {
		display: flex;
		justify-content: space-between;
		margin: 30rpx;
		font-size: 30rpx;
		font-weight: bold;
		background-color: #fff;
		border-radius: 20rpx;
		padding: 30rpx;

		.top-box-img {
			image {
				width: 40rpx;
				height: 40rpx;
			}
		}
	}

	.titleall-box {
		display: flex;
		justify-content: space-between;
		padding: 40rpx 20rpx 20rpx 0;

		.titleall-left {
			font-size: 32rpx;
			font-weight: bold;
			display: flex;
			align-items: center;

			.titleall-left-line {
				width: 14rpx;
				height: 36rpx;
				border-radius: 0 10rpx 10rpx 0;
				background-color: #667FFF;
				box-shadow: 0 0 10rpx 5rpx #d1d9ff;
				margin-right: 20rpx;
			}

			text {
				font-size: 28rpx;
				color: #999999;
			}
		}
	}

	.message-list {
		// background-color: #FFFFFF;
		border-radius: 20rpx;
		font-size: 26rpx;
		margin: 25rpx;
		padding: 20rpx 0;

		.info-box {
			background-color: #FFFFFF;
			margin-bottom: 10px;
			padding: 0 40rpx;
			border-radius: 20rpx;

			// margin-bottom: 30rpx;
			.info-box-list {
				display: flex;
				align-items: center;
				border-bottom: 2rpx solid #ececec;
				padding-top: 20rpx;
				padding-bottom: 20rpx;

				.width100 {
					width: 100% !important;
				}

				.info-box-width {
					width: 50%;
					font-size: 30rpx;
					font-weight: bold;

					.info-box-small {
						font-size: 26rpx;
						color: #a8a8a8;
						font-weight: 500;
						margin-top: 10rpx;
					}

					.info-box-list-img {
						margin-top: 30rpx;

						image {
							width: 180rpx;
							height: 180rpx;
							border-radius: 20rpx;
						}
					}

					.input-text {
						font-size: 30rpx;
					}

					.inputtext {
						color: #3d3d3d;
					}

					.textarea {
						background-color: #F7F7F7;
						border-radius: 20rpx;
						width: 100%;
						margin-top: 20rpx;
						padding: 20rpx;
						font-size: 28rpx;
						font-weight: normal;
						min-height: 80rpx;
					}
				}

				.serve {
					display: flex;
					justify-content: space-between;
					align-items: center;
					width: 100%;

					.serve-title {
						font-size: 25rpx;
						color: #909090;
						width: 25%;
					}

					.serve-right {
						font-size: 25rpx;
						font-weight: bold;
						display: flex;
						align-items: center;
						justify-content: flex-end;

						text {
							color: #FC4444;
						}

						image {
							width: 20rpx;
							height: 20rpx;
							margin-left: 10rpx;
						}
					}
				}
			}

			.info-box-list:last-child {
				border-bottom: 0;
			}
		}
	}

	/* 底部 */
	.page-footer {
		margin: 30rpx;
		display: flex;
		height: 100rpx;

		.footer-buy {
			height: 100%;
			width: 100%;

			.cart-add {
				display: flex;
				align-items: center;
				justify-content: center;
				margin-top: 60rpx;

				image {
					position: absolute;
					z-index: 0;
					width: 95%;
					height: 83rpx;
					box-shadow: 5rpx 10rpx 20rpx 0 #b7c8ff;
					border-radius: 100rpx;
				}

				text {
					font-size: 30rpx;
					font-weight: bold;
					color: #fff;
					position: absolute;
					z-index: 1;
				}
			}
		}
	}

	.serve-right {
		font-size: 30rpx;
		font-weight: bold;
		display: flex;
		align-items: center;
		justify-content: flex-end;

		text {
			color: #FC4444;
		}

		image {
			width: 20rpx;
			height: 20rpx;
			margin-left: 10rpx;
		}
	}
</style>