wkyy 5 ماه پیش
والد
کامیت
8dc27bfe7d
4فایلهای تغییر یافته به همراه414 افزوده شده و 0 حذف شده
  1. 34 0
      apis/parents/activity.js
  2. 14 0
      pages.json
  3. 223 0
      pages/parents/activity/add.vue
  4. 143 0
      pages/parents/activity/list.vue

+ 34 - 0
apis/parents/activity.js

@@ -0,0 +1,34 @@
+import request from '@/apis/utils/request.js';
+import requestWhite from '@/apis/utils/requestWhite.js';
+import Qs from 'qs';
+
+export function add(data) {
+	return requestWhite({
+		method: 'post',
+		data: data,
+		url: '/mobile/activityStudentInfoApi/add'
+	})
+}
+
+export function itemList(data) {
+	return requestWhite({
+		method: 'post',
+		data: data,
+		url: '/mobile/activityStudentInfoApi/itemList'
+	})
+}
+
+export function pageList(data) {
+	return requestWhite({
+		method: 'post',
+		data: data,
+		url: '/mobile/activityStudentInfoApi/pageList'
+	})
+}
+
+export function edit(id) {
+	return requestWhite({
+		method: 'get',
+		url: '/mobile/activityStudentInfoApi/edit/' + id
+	})
+}

+ 14 - 0
pages.json

@@ -745,6 +745,20 @@
 				"navigationBarTitleText": "",
 				"enablePullDownRefresh": false
 			}
+		},
+		{
+			"path": "pages/parents/activity/add",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/parents/activity/list",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
 		}
 
 	],

+ 223 - 0
pages/parents/activity/add.vue

@@ -0,0 +1,223 @@
+<template>
+	<view>
+		<u-navbar title="2025迎新春活动" :is-back="false"></u-navbar>
+		
+		<view class="infos">
+			<u-form :model="form" ref="uForm" label-width="200">
+				<u-form-item label="姓名" prop="name">
+					<u-input v-model="form.name" placeholder="请输入姓名" />
+				</u-form-item>
+				<u-form-item label="年龄" prop="age">
+					<u-input v-model="form.age" placeholder="请输入年龄" />
+				</u-form-item>
+				<u-form-item label="是否为青少年宫学员" label-width="400">
+					<u-radio-group v-model="radioValue" slot="right">
+						<u-radio name="1">是</u-radio>
+						<u-radio name="0">否</u-radio>
+					</u-radio-group>
+				</u-form-item>
+				<u-form-item label="所在项目" prop="categoryN">
+					<view style="width: 100%;" @click="show=true">
+						<u-input style="pointer-events: none" type="select" v-model="form.categoryN"
+							placeholder="请选择所在项目" />
+					</view>
+					<!-- <u-input v-model="form.categoryN" type="select" placeholder="请选择所在项目" @click="show=true" /> -->
+				</u-form-item>
+				<u-form-item label="家长联系方式" prop="contact">
+					<u-input v-model="form.contact" placeholder="请输入家长联系方式" />
+				</u-form-item>
+			</u-form>
+		</view>
+		
+		<u-select v-model="show" mode="single-column" :list="activityList" label-name="name"
+			@confirm="confirm"></u-select>
+			
+		<view>
+			<u-toast ref="uToast" />
+		</view>
+		
+		<view class="btn">
+			<button @click="submit">提 交</button>
+		</view>
+	</view>
+</template>
+
+<script>
+	import * as activityApi from '@/apis/parents/activity.js'
+	
+	export default {
+		data() {
+			return {
+				activityId: '',
+				radioValue: '1',
+				show: false,
+				activityList: [],
+				form: {
+					id: '',
+					name: '',
+					age: '',
+					isStudent: '',
+					category: '',
+					categoryN: '',
+					contact: ''
+				},
+				rules: {
+					name: [{
+						required: true,
+						message: '请输入姓名',
+						trigger: ['change', 'blur'],
+					}],
+					age: [{
+						required: true,
+						message: '请输入年龄',
+						trigger: ['change', 'blur'],
+					}],
+					categoryN: [{
+						required: true,
+						message: '请选择所在项目',
+						trigger: ['change', 'blur'],
+					}],
+					contact: [{
+						required: true,
+						message: '请输入家长联系方式',
+						trigger: ['change', 'blur'],
+					}]
+				}
+			}
+		},
+		onLoad(op) {
+			if(op.id) {
+				this.activityId = op.id;
+				this.getEdit();
+			}
+		},
+		onReady() {
+			this.$refs.uForm.setRules(this.rules);
+			
+			this.getActivityList();
+		},
+		methods: {
+			getEdit() {
+				activityApi.edit(this.activityId).then((response) => {
+					this.form = response.data;
+					if(this.form.isStudent) {
+						this.radioValue = '1';
+					} else {
+						this.radioValue = '0';
+					}
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			getActivityList() {
+				activityApi.itemList().then((response) => {
+					this.activityList = response.data;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			submit() {
+				this.$refs.uForm.validate(valid => {
+					if (valid) {
+						if(this.radioValue == '1') {
+							this.form.isStudent = true;
+						} else {
+							this.form.isStudent = false;
+						}
+						activityApi.add(this.form).then((response) => {
+							this.$refs.uToast.show({
+								title: '报名成功',
+								type: 'success'
+							})
+						}).catch(error => {
+							uni.showToast({
+								title: error,
+								icon: "none"
+							})
+						})
+					}
+				});
+			},
+			confirm(e) {
+				this.form.category = e[0].value;
+				this.form.categoryN = e[0].label;
+			},
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.infos {
+		padding: 0px 30rpx;
+		background-color: #fff;
+		margin-bottom: 24rpx;
+
+		.item {
+			display: flex;
+			justify-content: space-between;
+			border-bottom: 1px solid rgba(244, 244, 244, 1);
+			padding: 24rpx 0;
+
+			.title {
+				color: #333333;
+				font-weight: bold;
+
+				.asterisk {
+					color: rgba(244, 68, 68, 1);
+				}
+			}
+
+			.value {
+				color: rgba(51, 51, 51, 1);
+				font-weight: bold;
+
+				.icon {
+					margin-left: 8rpx;
+				}
+
+				.add {
+					color: #FF3D00;
+				}
+
+				.placeholder {
+					color: #CCCCCC;
+				}
+			}
+		}
+	}
+
+	.btn {
+		padding: 20rpx 0;
+		background-color: #fff;
+		position: fixed;
+		bottom: 0;
+		left: 0;
+		right: 0;
+
+		button {
+			width: 91.4%;
+			border-radius: 50px;
+			background-color: rgba(13, 186, 199, 1);
+			color: rgba(255, 255, 255, 1);
+			font-size: 16px;
+			line-height: 80rpx;
+
+		}
+	}
+
+	/deep/uni-input {
+		width: 300rpx;
+		text-align: right !important;
+
+	}
+
+	/deep/.uni-input-placeholder {
+		color: #cccccc !important;
+	}
+</style>

+ 143 - 0
pages/parents/activity/list.vue

@@ -0,0 +1,143 @@
+<template>
+	<view>
+		<u-navbar title="2025迎新春活动" :is-back="false"></u-navbar>
+
+		<view class="main">
+			<view class="item" v-for="(item,index) in activityList" :key="index"
+				@click="toUpdate(item)">
+				<view class="infos">
+					<view class="course">
+						<view class="name">
+							ddbddb
+						</view>
+					</view>
+				</view>
+			</view>
+		</view>
+		
+		<view class="btn">
+			<button @click="toAdd">报 名</button>
+		</view>
+	</view>
+</template>
+
+<script>
+	import * as activityApi from '@/apis/parents/activity.js'
+
+	export default {
+		data() {
+			return {
+				activityList: []
+			}
+		},
+		onReady() {
+			this.getActivityList();
+		},
+		methods: {
+			toUpdate(item) {
+				uni.navigateTo({
+					url: '/pages/parents/activity/add?id=' + item.id
+				})
+			},
+			toAdd() {
+				uni.navigateTo({
+					url: '/pages/parents/activity/add'
+				})
+			},
+			getActivityList() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				activityApi.pageList({
+					name: '',
+					pageIndex: 1,
+					pageSize: 1000
+				}).then((response) => {
+					uni.hideLoading();
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.main {
+		margin-top:88rpx;
+		.item {
+			.date {
+				padding: 24rpx 32rpx;
+				color: rgba(119, 119, 119, 1);
+			}
+
+			.infos {
+				background-color: #fff;
+				padding: 24rpx 36rpx;
+				display: flex;
+				align-items: center;
+
+				.picture {
+					width: 92rpx;
+					height: 92rpx;
+
+					img {
+						width: 100%;
+						height: 100%;
+					}
+				}
+
+				.course {
+					margin-left: 24rpx;
+
+					.name {
+						color: rgba(51, 51, 51, 1);
+						font-size: 16px;
+						font-weight: bold;
+					}
+
+					.season-hour {
+						display: flex;
+						color: rgba(119, 119, 119, 1);
+						margin-top: 8rpx;
+
+						.hour {
+							margin-left: 8rpx;
+						}
+					}
+
+				}
+
+				.price {
+					color: rgba(16, 16, 16, 1);
+					font-size: 18px;
+					font-weight: bold;
+					margin-left: auto;
+				}
+			}
+		}
+	}
+	
+	.btn {
+		padding: 20rpx 0;
+		background-color: #fff;
+		position: fixed;
+		bottom: 0;
+		left: 0;
+		right: 0;
+	
+		button {
+			width: 91.4%;
+			border-radius: 50px;
+			background-color: rgba(13, 186, 199, 1);
+			color: rgba(255, 255, 255, 1);
+			font-size: 16px;
+			line-height: 80rpx;
+	
+		}
+	}
+</style>