add-team-activity.vue 6.0 KB
Newer Older
Y
yyt 已提交
1 2 3 4 5
<template>
	<view class="add-school-activity">
		<view class="nav-bar-back">
			<image class="nav-bar-back-icon" src="/static/discover/back.png" @click="goBack"></image>
			<view class="nav-bar-title">发起活动</view>
2
222000134 已提交
6
			<image class="nav-bar-add" src="../../static/post/发送.png" @click="submit"></image>
Y
yyt 已提交
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
		</view>
		<view class="school-activity-icon-wrapper">
			<image class="school-activity-icon" src="/static/discover/activity-icon.png"></image>
		</view>
		<view class="school-activity-item-wrapper">
			<view class="form-group">
				<image class="form-icon" src="/static/discover/name.png"></image>
				<input class="form-input" type="text" placeholder="请输入活动名称" v-model="name">
			</view>
			<view class="form-group">
				<image class="form-icon" src="/static/discover/content.png"></image>
				<textarea class="form-input1" placeholder="请输入活动内容" v-model="content"></textarea>
			</view>
			<view class="form-group">
				<image class="form-icon" src="/static/discover/activity-time.png"></image>
				<view class="input-wrapper">
2
222000134 已提交
23 24 25 26 27 28 29 30 31 32 33
					<view class="form-input2-wrapper">
						<view class="form-input2">
							<picker mode="date" start="1970-01-01" end="2100-12-31" @change="handleDateChange1">
								<view class="picker">{{ start_date }}</view>
							</picker>
						</view>
						<view class="form-input2">
							<picker mode="time" start="00:00" end="23:59" @change="handleTimeChange1">
								<view class="picker">{{ start_time }}</view>
							</picker>
						</view>
Y
yyt 已提交
34
					</view>
2
222000134 已提交
35 36 37 38 39 40 41 42 43 44 45 46
					<view class="form-input2-wrapper">

						<view class="form-input2">
							<picker mode="date" start="1970-01-01" end="2100-12-31" @change="handleDateChange2">
								<view class="picker">{{ end_date }}</view>
							</picker>
						</view>
						<view class="form-input2">
							<picker mode="time" start="00:00" end="23:59" @change="handleTimeChange2">
								<view class="picker">{{ end_time }}</view>
							</picker>
						</view>
Y
yyt 已提交
47 48 49 50 51
					</view>
				</view>
			</view>
			<view class="form-group">
				<image class="form-icon" src="/static/discover/activity-object.png"></image>
2
小队  
222000134 已提交
52
				<input class="form-input" type="number" placeholder="请输入参与人数" v-model="object">
Y
yyt 已提交
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
			</view>
			<view class="form-group">
				<image class="form-icon" src="/static/discover/activity-place.png"></image>
				<input class="form-input" type="text" placeholder="请输入活动地点" v-model="place">
			</view>
			<view class="form-group">
				<image class="form-icon" src="/static/discover/activity-contact.png"></image>
				<input class="form-input" type="text" placeholder="请输入活动联系方式" v-model="contact">
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
2
222000134 已提交
70
				userId: '',
Y
yyt 已提交
71 72 73 74 75
				name: '',
				content: '',
				object: '',
				place: '',
				contact: '',
2
222000134 已提交
76 77 78 79
				start_date: '2023-05-10',
				end_date: '2023-05-10',
				start_time: '18:00',
				end_time: '18:00',
Y
yyt 已提交
80 81 82 83 84 85 86 87 88 89
			}
		},
		methods: {
			goBack() {
				uni.reLaunch({
					url: '/pages/team/main',
					animationType: 'pop-in',
					animationDuration: 300
				})
			},
2
222000134 已提交
90 91
			onLoad() {
				this.userId = getApp().globalData.userId
2
小队  
222000134 已提交
92
			},
Y
yyt 已提交
93
			async submit() {
2
222000134 已提交
94 95
				if (this.name == '' || this.content == '' || this.start_date == '' || this.end_date == '' || this
					.place == '' || this.object == '' || this.contact == '') {
2
小队  
222000134 已提交
96 97 98 99 100 101
					uni.showToast({
						title: '信息填写不完整',
						icon: 'none'
					});
					return;
				}
2
222000134 已提交
102 103 104
				this.start_date=this.start_date+' '+this.start_time
				this.end_date=this.end_date+' '+this.end_time
				console.log(this.userId, 'this.userId')
Y
yyt 已提交
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
				uniCloud.callFunction({
						name: 'fe-team-createActivity',
						data: {
							title: this.name,
							content: this.content,
							startDate: this.start_date,
							endDate: this.end_date,
							userId: this.userId,
							place: this.place,
							participants: this.object,
							contact: this.contact,
						}
					})
					.then(res => {
						console.log(res)
						uni.showToast({
							title: '提交成功',
							icon: 'success'
						});
					})
			},
			handleDateChange1(event) {
				this.start_date = event.detail.value
			},
			handleDateChange2(event) {
				this.end_date = event.detail.value
			},
2
222000134 已提交
132 133 134 135 136 137
			handleTimeChange1(event) {
				this.start_time = event.detail.value
			},
			handleTimeChange2(event) {
				this.end_time = event.detail.value
			},
Y
yyt 已提交
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
		}
	}
</script>

<style>
	.add-school-activity {
		position: absolute;
		width: 100%;
		height: 100%;
	}

	.nav-bar-back {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		height: 60px;
		background-color: #EDEEF0;
	}

	.nav-bar-back-icon {
		width: 40px;
		height: 30px;
		margin-left: 20rpx;
		margin-right: auto;
	}

	.nav-bar-title {
		flex: 1;
		text-align: center;
		font-size: 24px;
		font-weight: bold;
		color: #F1992D;
	}

	.nav-bar-add {
		width: 30px;
		height: 30px;
		margin-top: 10px;
		float: right;
		margin-right: 10px;
	}

	.school-activity-icon-wrapper {
		margin-top: 20px;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.school-activity-icon {
		width: 50%;
		height: 80px;
		margin: 0px;
		padding: 0px;
	}

	.school-activity-item-wrapper {
		margin-top: 20px;
	}

	.form-group {
		display: flex;
		align-items: center;
		margin-top: 15px;
	}

	.form-icon {
		width: 40px;
		height: 30px;
		margin-left: 30px;
	}

	.form-input {
		margin-left: 5px;
		width: 70%;
		height: 35px;
		border: none;
		outline: none;
		font-size: 14px;
		color: #333;
		padding: 0 10px;
2
222000134 已提交
220
		background-color: #edeef0;
Y
yyt 已提交
221 222 223 224 225 226 227 228 229 230 231
	}

	.form-input1 {
		margin-left: 5px;
		width: 70%;
		height: 70px;
		border: none;
		outline: none;
		font-size: 14px;
		color: #333;
		padding: 0 10px;
2
222000134 已提交
232
		background-color: #edeef0;
Y
yyt 已提交
233 234 235 236 237 238 239 240
	}

	.input-wrapper {
		flex-direction: column;
		display: flex;
		width: 100%;
	}

2
222000134 已提交
241 242 243 244 245
	.form-input2-wrapper {
		display: flex;
		flex-direction: row;
	}

Y
yyt 已提交
246 247 248
	.form-input2 {
		margin-top: 5px;
		margin-left: 10px;
2
222000134 已提交
249
		width: 30%;
Y
yyt 已提交
250 251 252 253 254
		height: 35px;
		border: none;
		outline: none;
		font-size: 14px;
		color: #333;
2
222000134 已提交
255
		background-color: #edeef0;
Y
yyt 已提交
256 257 258
		padding: 0 10px;
	}
</style>