update-textarea.vue 2.7 KB
<template>
	<view style=" width: 100%; height: 100%; display: flex;background-color: #F7F7F7;" :style="vuex_theme">
		<view class="wrap_box">
			<view class="text_gray_26">{{title}}</view>
			<view style="min-height: 300rpx;width: 100%;padding: 20rpx 0;">
				<u-input v-model="value" type="textarea" :maxlength='maxLength' placeholder="请输入内容" :custom-style="text_black_30"
					:placeholder-style="text_gray_30"/>
			</view>
			<!-- <view class="text_gray_30" style="text-align: right;">{{value.length}}/{{maxLength}}</view> -->
			<view style="height: 2rpx;margin: 30rpx 0;background-color: #e5e5e5;"></view>
		</view>
		<view class="footer">
			<view style="width: 100%;height: 1rpx;border: 1rpx solid #f7f7f7;"></view>
			<view style="padding: 20rpx 40rpx 70rpx 40rpx;" >
				<view class="confirm" @click="confirm">确认</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title:"",
				maxLength:300,
				curLength:0,
				value:'',
			}
		},
		
		onLoad(option) {
			console.log(option)
			this.title = "my-special"==option.type?"我的优势":"兴趣爱好"
			this.value = option.value?option.value:''
			uni.setNavigationBarTitle({title:this.title });
		},
		
		methods: {
			confirm(){
				if(this.value&&this.value.length>0){
					let pages = getCurrentPages();
					let prevPage = pages[pages.length - 2];
					if("我的优势"==this.title){
						if(prevPage.$vm.form){
							prevPage.$vm.form.personal_ability = this.value;
						}else{
							prevPage.$vm.detailObj.personal_ability = this.value;
						}
					}else{//兴趣爱好
						prevPage.$vm.detailObj.hobbies = this.value;
					}
					console.log(this.value)
					uni.navigateBack({
						delta:1
					})
				}else{
					uni.showToast({
						title:"请输入内容!",
						icon:"none"
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.wrap_box {
		padding: 40rpx;
		background-color: #fff;
		margin: 20rpx 20rpx 0 20rpx;
		width: 100%;

		.text_black_30 {
			font-size: 30rpx;
			font-family:' PingFangSC-Regular, PingFang SC';
			font-weight: 500;
			color: #000000;
			line-height: 30rpx;
		}

		.text_gray_26 {
			font-size: 26rpx;
			font-weight: 400;
			color: #000000;
		}

		.text_gray_30 {
			font-size: 30rpx;
			color:rgba(0,0,0,0.45);
			line-height: 30rpx;
		}
	}

	.footer {
		width: 100%;
		background-color: #fff;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 999;
	
		.confirm {
			background: linear-gradient(180deg, var(--primary-color000) 0%, var(--primary-color) 100%);
			box-shadow: 0px 2px 20px 0px var(--primary-color03);
			border-radius: 24px;
			padding: 24rpx;
			text-align: center;
			font-size: 34rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #FFFFFF;
		}
	}
</style>