publish.vue 4.3 KB
<template>
	<view>
		<form>
			<view style="padding: 0 32rpx;background: #fff;">
				<view class="cu-form-group">
					<view class="title">科室</view>
					<picker @change="PickerChange" :value="index" :range="picker">
						<view class="picker" :style="{'text-align': 'left','color':index>-1?'#323232':'#808080'}">
							{{index>-1?picker[index]:'请选择科室'}}
						</view>
					</picker>
				</view>
				<view class="cu-form-group">
					<view class="title">需求标题</view>
					<input placeholder="请输入需求标题" name="input"></input>
				</view>
				<!-- !!!!! placeholder 在ios表现有偏移 建议使用 第一种样式 -->
				<view class="cu-form-group">
					<view class="title">内容</view>
				</view>
				<view class="cu-form-group" style="border-top: none;">
					<textarea maxlength="1000" v-model="textareaAValue" @input="textareaAInput" placeholder="请描述您的需求内容..."></textarea>
				</view>
				<view class="cu-form-group" style="padding-top: 32rpx;">
					<view class="grid col-4 grid-square flex-sub">
						<view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" :data-url="imgList[index]">
						 <image :src="imgList[index]" mode="aspectFill"></image>
							<view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
								<text class='cuIcon-close'></text>
							</view>
						</view>
						<view class="solids" style="width: 182rpx;height: 182rpx;" @tap="ChooseImage" v-if="imgList.length<9">
							<image src="../../static/image/no_upload@2x.png" style="width: 182rpx;height: 182rpx;" mode=""></image>
						</view>
					</view>
				</view>
			</view>
			<view class="cu-bar margin-top" style="display: flex;justify-content: center;">
				<view style="background: #2e7ff9;border-radius: 80rpx;height: 80rpx;width: 686rpx;color: #fff;text-align: center;line-height: 80rpx;">
					提交
				</view>
			</view>
		</form>
		<u-tabbar
			v-model="tabBarCurrent"
			:show="show"
			:bg-color="bgColor"
			:border-top="borderTop"
			:list="tabBarList"
			:mid-button="midButton"
			:inactive-color="inactiveColor"
			:activeColor="activeColor"
		></u-tabbar>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//底部导航栏区域 开始
				tabBarCurrent: 0,
				show: true,
				bgColor: '#ffffff',
				borderTop: true,
				tabBarList: [{
						iconPath: "/static/image/ic_8@2x.png",
						selectedIconPath: "/static/image/ic_8_select@2x.png",
						text: '首页',
						customIcon: false,
					},
					{
						iconPath: "/static/image/ic_9@2x.png",
						selectedIconPath: "/static/image/ic_9_select@2x.png",
						text: '需求',
						customIcon: false,
					},
					{
						iconPath: "/static/image/ic_10@2x.png",
						selectedIconPath: "/static/image/ic_10_select@2x.png",
						text: '我的',
						customIcon: false,
					},
				],
				midButton: false,
				inactiveColor: '#909399',
				activeColor: '#5098FF',
				//底部导航栏区域 结束
				index: -1,
				picker: ['科室1', '科室2', '科室3'],
				multiIndex: [0, 0, 0],
				imgList: [],
				modalName: null,
				textareaAValue: '',
				textareaBValue: ''
			};
		},
		methods: {
			PickerChange(e) {
				this.index = e.detail.value
			},
			ChooseImage() {
				uni.chooseImage({
					count: 4, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
					sourceType: ['album'], //从相册选择
					success: (res) => {
						if (this.imgList.length != 0) {
							this.imgList = this.imgList.concat(res.tempFilePaths)
						} else {
							this.imgList = res.tempFilePaths
						}
					}
				});
			},
			ViewImage(e) {
				uni.previewImage({
					urls: this.imgList,
					current: e.currentTarget.dataset.url
				});
			},
			DelImg(e) {
				uni.showModal({
					title: '提示',
					content: '确定要删除此照片吗?',
					cancelText: '再看看',
					confirmText: '确认',
					success: res => {
						if (res.confirm) {
							this.imgList.splice(e.currentTarget.dataset.index, 1)
						}
					}
				})
			},
			textareaAInput(e) {
				this.textareaAValue = e.detail.value
			},
			textareaBInput(e) {
				this.textareaBValue = e.detail.value
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-color: $uni-bg-color-hui;
	}
	.cu-form-group .title {
		min-width: calc(4em + 30px);
	}
</style>