xhj 2 лет назад
Родитель
Сommit
e67dffee04

+ 15 - 1
match/activityEdit/activityEdit.vue

@@ -41,6 +41,16 @@
 						<image src="../../static/pages/images/more.png"></image>
 					</view>
 				</view>
+				<view class="form-input-box" style="padding: 18rpx 0;">
+				</view>
+				<view class="form-item-title">
+					自定义报名信息
+					<view class="more ddflex" @click="jumpUrl('/match/addForm/addForm')">
+						<text style="color: #999;" v-if="!extForm">添加(非必填)</text>
+						<text v-else style="color: var(--main);">已添加</text>
+						<image src="../../static/pages/images/more.png"></image>
+					</view>
+				</view>
 				<view class="next-btn" @click="next">下一步</view>
 			</view>
 		</view>
@@ -193,7 +203,9 @@
 				rightArray: [],
 				
 				companyTreeList:[],
-				checkNum:0
+				checkNum:0,
+				
+				extForm:''
 
 			}
 		},
@@ -281,6 +293,7 @@
 					this.brief = res.brief
 					this.text = res.text
 					this.personLimit = res.personLimit
+					this.extForm = res.extForm
 					this.enlistStartTime = this.formatTime(res.enlistStartTime)
 					this.enlistEndTime = this.formatTime(res.enlistEndTime)
 					this.startTime = this.formatTime(res.startTime)
@@ -569,6 +582,7 @@
 					isDefault: 0
 				}]
 				dataP.prices = prices
+				dataP.extForm = this.extForm?this.extForm:null
 				let url = '/api/match/save'
 				if (this.id) {
 					dataP.id = this.id

+ 230 - 0
match/addForm/addForm.css

@@ -0,0 +1,230 @@
+page{
+	background-color: #fff;
+}
+.form{
+	padding: 30rpx;
+}
+.form-title{
+	line-height: 50rpx;
+	font-size: 36rpx;
+	font-family: PingFang SC-Bold, PingFang SC;
+	font-weight: bold;
+	color: #333333;
+}
+.form-item-title{
+	line-height: 45rpx;
+	font-size: 32rpx;
+	font-family: PingFang SC-Medium, PingFang SC;
+	font-weight: 500;
+	color: #333333;
+	margin-top: 32rpx;
+}
+.form-border{
+	height: 20rpx;
+	background: #F8F8F8;
+	border-radius: 0rpx 0rpx 0rpx 0rpx;
+	opacity: 1;
+}
+.form-input-box{
+	padding: 30rpx 0;
+	border-bottom: 2rpx solid #DEDEDE;
+	line-height: 45rpx;
+	font-size: 32rpx;
+}
+.form-input-box input{
+	font-size: 32rpx;
+}
+.form-input-placeholder{
+	color: #CCCCCC;
+	font-size: 32rpx;
+}
+.p-form{
+	padding:40rpx;
+}
+.p-form-item{
+	margin-bottom: 40rpx;
+}
+.p-label{
+	line-height: 45rpx;
+	font-size: 32rpx;
+	font-family: PingFang SC-Semibold, PingFang SC;
+	font-weight: 500;
+	color: #333333;
+	margin-top: 20rpx;
+	margin-bottom: 20rpx;
+}
+.p-input{
+	background: #F8F8F8;
+	border-radius: 8rpx;
+	padding: 24rpx;
+	opacity: 1;
+	font-size: 26rpx;
+}
+.p-placeholder{
+	font-size: 26rpx;
+	color: #999999;
+}
+.p-select{
+	line-height: 47rpx;
+	font-size: 32rpx;
+	font-family: Source Han Sans CN-Regular, Source Han Sans CN;
+	font-weight: 400;
+	color: #999999;
+}
+.p-select-item{
+	margin-right: 70rpx;
+}
+.p-select-item:last-child{
+	margin-right: 0;
+}
+.p-select-item image{
+	width: 30rpx;
+	height: 30rpx;
+	margin-right: 12rpx;
+}
+
+.p-select-group{
+
+}
+.p-select-group-item{
+	line-height: 70rpx;
+	font-size: 28rpx;
+	font-family: PingFang SC-Regular, PingFang SC;
+	font-weight: 400;
+	color: #333333;
+	background: #F3F5F7;
+	border-radius: 35rpx 35rpx 35rpx 35rpx;
+	padding: 0 30rpx;
+	margin-right: 20rpx;
+}
+.p-select-group-item-active{
+	background-color: var(--main);
+	color: #fff;
+}
+
+.upload-photo{
+	width: 120rpx;
+	height: 120rpx;
+	background: #F8F8F8;
+	border-radius: 10rpx 10rpx 10rpx 10rpx;
+	opacity: 1;
+	margin-bottom: 20rpx;
+}
+.upload-photo image{
+	width: 46rpx;
+	height: 35rpx;
+	margin: auto;
+}
+.upload-photo-image{
+	width: 120rpx;
+	height: 120rpx;
+	border-radius: 10rpx 10rpx 10rpx 10rpx;
+	opacity: 1;
+	margin-right: 20rpx;
+	position: relative;
+	margin-bottom: 20rpx;
+}
+.upload-photo-image:nth-child(5n){
+	margin-right: 0rpx;
+}
+.upload-photo-image image{
+	width: 120rpx;
+	height: 120rpx;
+	border-radius: 10rpx 10rpx 10rpx 10rpx;
+}
+.upload-photo-close{
+	width: 28rpx !important;
+	height: 28rpx !important;
+	position: absolute;
+	top:-14rpx;
+	right: -14rpx;
+}
+
+.add-btn{
+	width: 30rpx;
+	height: 30rpx;
+	margin: auto;
+	border-radius: 100%;
+	background-color: var(--main);
+	padding: 20rpx;
+}
+.add-btn image{
+	width: 100%;
+	height:100%;
+}
+
+
+.next-btn{
+	position: fixed;
+	bottom: 30rpx;
+	left: 0;
+	right: 0;
+	height: 88rpx;
+	line-height: 88rpx;
+	background: #27D699;
+	border-radius: 44rpx 44rpx 44rpx 44rpx;
+	font-size: 36rpx;
+	font-family: PingFang SC-Regular, PingFang SC;
+	font-weight: 400;
+	color: #FFFFFF;
+	text-align: center;
+	margin: 30rpx 30rpx 30rpx;
+}
+
+.more{
+	float: right;
+}
+.more image{
+	width: 14rpx;
+	height: 22rpx;
+	margin-left: 10rpx;
+}
+
+.option-input{
+	border: 2rpx solid #eeeeee;
+	font-size: 26rpx;
+	padding: 10rpx 20rpx;
+	margin-top: 20rpx;
+	border-radius: 4rpx;
+}
+.option-input input{
+	color: #333;
+	font-size: 26rpx;
+}
+.option-input-placeholder{
+	font-size: 26rpx;
+}
+.option-input-delete{
+	border: 2rpx solid red;
+	background-color: red;
+	color: #fff;
+	font-size: 24rpx;
+	padding: 0rpx 10rpx;
+	/* margin-top: 20rpx; */
+	border-radius: 6rpx;
+}
+.add-option-btn{
+	background-color: var(--main);
+	width: 180rpx;
+	height: 60rpx;
+	line-height: 60rpx;
+	color: #fff;
+	font-size: 26rpx;
+	text-align: center;
+	margin: auto;
+	border-radius: 100rpx;
+	margin-top: 20rpx;
+	
+}
+/* 核销弹窗 */
+.ceng{position: fixed;top: 0;left: 0;right: 0;bottom: 0;background-color: rgba(0,0,0,.5);z-index: 99;}
+.hx-pop{position: fixed;left: 0;right: 0;bottom: 0;background-color: #fff;border-radius: 32rpx 32rpx 0 0;z-index: 100;transition: all .3s ease;}
+.pop-tit{font-size: 36rpx;color: #333;text-align: center;padding: 40rpx 0 0;font-weight: bold;}
+.pop-list{margin-top: 10rpx;padding: 10rpx 44rpx 48rpx;overflow-y: scroll;max-height: 600rpx;}
+::-webkit-scrollbar{
+	display: none;
+	background-color: transparent;
+}
+.pop-list .li{height: 130rpx;background-color: #fff;border-radius: 10rpx;padding: 0 39rpx 0 49rpx;font-size: 30rpx;color: #333;margin-top: 30rpx;}
+.li-ico{width: 48rpx;height: 48rpx;margin-right: 17rpx;}
+.pop-cancel{font-size: 36rpx;color: #666;padding: 42rpx 0 52rpx;text-align: center;background-color: #fff;}

+ 243 - 0
match/addForm/addForm.vue

@@ -0,0 +1,243 @@
+<template>
+	<view class="p-form">
+		<view v-for='item,index in extForm' class="p-form-item" :key="index">
+			<view class="p-label ddflex" style="justify-content: space-between;">
+				{{item.chineseName}}
+				<view class="ddflex" style="font-size: 24rpx;">
+					<text style="color: blue;" @click="editItem(index)">编辑</text>
+					<text style="margin-left: 20rpx;color: red;" @click="removeItem(index)">删除</text>
+				</view>
+			</view>
+			<!-- 输入框 -->
+			<view v-if="item.type==1" class="p-input">
+				<input :placeholder="'请输入'+item.chineseName" placeholder-class="p-placeholder" />
+			</view>
+			<!-- 单选 -->
+			<view v-if="item.type==2" class="p-select">
+				<view class="ddflex">
+					<view class="ddflex p-select-item" v-for="it in item.selectValues">
+						<image src="/static/images/select.png"></image>
+						<view>{{it.name}}</view>
+					</view>
+				</view>
+			</view>
+			<!-- 多选 -->
+			<view v-if="item.type==3" class="p-select-group">
+				<view class="ddflex">
+					<view class="ddflex p-select-group-item" v-for="it in item.selectValues">
+						<view>{{it.name}}</view>
+					</view>
+				</view>
+			</view>
+			<!-- 图片 -->
+			<view v-if="item.type==4">
+				<view class="ddflex" style="margin-top: 30rpx;">
+					<view class="upload-photo ddflex">
+						<image src="../static/images/photo.png"></image>
+					</view>
+				</view>
+			</view>
+			<!-- 多图片 -->
+			<view v-if="item.type==5">
+				<view class="ddflex" style="margin-top: 30rpx;">
+					<view class="upload-photo ddflex">
+						<image src="../static/images/photo.png"></image>
+					</view>
+				</view>
+			</view>
+		</view>
+		
+		<view v-if="extForm.length==0" style="text-align: center;margin: 30rpx 0;color: #999;">添加报名字段</view>
+		<view class="add-btn" @click="showPop">
+			<image src="../static/images/add.png"></image>
+		</view>
+
+
+		<view class="next-btn" @click="save">
+			<view>确定</view>
+		</view>
+
+
+		<view class="ceng" v-if="isShowPop" @click="hidePop()"></view>
+		<view class="hx-pop" :style="'bottom:' + popBottom">
+			<view class="pop-tit">添加报名信息</view>
+			<view class="pop-list">
+				<view class="form">
+					<view class="form-item-title">名称</view>
+					<view class="form-input-box">
+						<input v-model="addObj.chineseName" placeholder-class="form-input-placeholder"
+							placeholder="请输入名称(如 姓名)" />
+					</view>
+					<view class="form-item-title">字段名</view>
+					<view class="form-input-box">
+						<input v-model="addObj.englishName" placeholder-class="form-input-placeholder"
+							placeholder="请输入字段名(如 name)" />
+					</view>
+					<view class="form-item-title">字段类型</view>
+					<view class="form-input-box form-input-placeholder">
+						<picker :range="formTypeOptions" range-key="label" v-model="formTypeIndex" @change="changeType" style="color: #333;">
+								{{formTypeOptions[formTypeIndex].label}}
+								<view class="more ddflex">
+									<image src="/static/pages/images/more.png"></image>
+								</view>
+						</picker>
+						<view v-if="formTypeOptions[formTypeIndex].value==2||formTypeOptions[formTypeIndex].value==3">
+							<view class="ddflex option-input" v-for="it,idx in addObj.selectValues">
+								<input v-model="it.name" class="fflex" placeholder-class="option-input-placeholder" placeholder="请输入选项值"/>
+								<view class="option-input-delete" @click="removeOption(idx)">删除</view>
+							</view>
+							<view class="add-option-btn" @click="addOption">添加选项</view>
+						</view>
+					</view>
+					<view class="form-item-title ddflex" style="justify-content: space-between;">
+						是否必填
+						<switch v-model="addObj.required" :checked="addObj.required==1" style="transform:scale(0.7)" color="var(--main)"
+							@change="requiredChange"></switch>
+					</view>
+				</view>
+			</view>
+			<view class="pop-cancel" @click="confirmPop()">确定</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	const app = getApp();
+	const req = require("../../utils/request.js");
+
+	export default {
+		components: {},
+		props: {},
+		data() {
+			return {
+				isShowPop: false,
+				popBottom: '-100%',
+				addObj: {
+					englishName: '',
+					chineseName: '',
+					type: 1,
+					selectValues: null,
+					required: 1,
+					value: ''
+				},
+				extForm: [],
+				formTypeOptions: [{
+					value: '1',
+					label: '输入框'
+				}, {
+					value: '2',
+					label: '单选框'
+				}, {
+					value: '3',
+					label: '多选框'
+				}, {
+					value: '4',
+					label: '单图片'
+				}, {
+					value: '5',
+					label: '多图片'
+				}],
+				formTypeIndex:0,
+				editIndex:-1
+			}
+		},
+		onLoad(options) {
+			let pages = getCurrentPages(); //获取所有页面栈实例列表
+			let prevPage = pages[pages.length - 2]; //上一页页面实例
+			if(prevPage.$vm.extForm){
+				this.extForm = JSON.parse(prevPage.$vm.extForm);
+			}
+		},
+		onShow() {
+
+		},
+		methods: {
+			showPop() {
+				this.isShowPop = true;
+				this.popBottom = 0;
+			},
+			hidePop() {
+				this.editIndex = -1
+				this.isShowPop = false;
+				this.popBottom = '-100%';
+				this.clearPop()
+			},
+			clearPop(){
+				this.editIndex = -1
+				this.formTypeIndex = 0
+				this.addObj = {
+					englishName: '',
+					chineseName: '',
+					type: 1,
+					selectValues: null,
+					required: 1,
+					value: ''
+				}
+			},
+			confirmPop(){
+				if(!this.addObj.chineseName) return req.msg('请输入名称')
+				if(!this.addObj.englishName) return req.msg('请输入字段名')
+				if(!this.addObj.type) return req.msg('请选择字段类型')
+				if(this.addObj.selectValues) {
+					for(let i=0;i<this.addObj.selectValues.length;i++){
+						if(!this.addObj.selectValues[i].name) return req.msg('请输入选项值')
+					}
+				}
+				console.log(this.addObj)
+				if(this.editIndex>-1){
+					this.extForm[this.editIndex] = this.addObj
+				}else{
+					this.extForm.push(this.addObj)
+				}
+				console.log(this.addObj)
+				this.hidePop()
+			},
+			editItem(index){
+				this.editIndex = index
+				this.addObj = this.extForm[index]
+				this.formTypeIndex = this.formTypeOptions.findIndex(item=>item.value==this.extForm[index].type)
+				this.showPop()
+			},
+			removeItem(index){
+				this.extForm.splice(index,1)
+			},
+			changeType(e) {
+				console.log(e)
+				let index = e.detail.value
+				this.formTypeIndex = index
+				this.addObj.type = this.formTypeOptions[index].value
+				if (this.formTypeOptions[index].value == 2 || this.formTypeOptions[index].value == 3) {
+					this.addObj.selectValues = [{name:''}]
+				} else {
+					this.addObj.selectValues = null
+				}
+				console.log(this.addObj)
+				this.addObj = JSON.parse(JSON.stringify(this.addObj))
+			},
+			addOption(){
+				this.addObj.selectValues.push({name:''})
+				this.addObj = JSON.parse(JSON.stringify(this.addObj))
+			},
+			removeOption(index){
+				console.log(this.addObj.selectValues,index)
+				this.addObj.selectValues.splice(index,1)
+			},
+			requiredChange(e){
+				this.addObj.required = e.detail.value?1:0
+			},
+			save(){
+				let pages = getCurrentPages();
+				let prevPage = pages[pages.length - 2];
+				prevPage.$vm.extForm = JSON.stringify(this.extForm);
+				uni.navigateBack({
+					delta: 1
+				});
+			}
+		},
+		mounted() {},
+	}
+</script>
+
+<style>
+	@import "./addForm.css";
+</style>

+ 5 - 0
pages.json

@@ -47,6 +47,11 @@
 				"style": {
 					"navigationBarTitleText": "活动详情"
 				}
+			},{
+				"path": "addForm/addForm",
+				"style": {
+					"navigationBarTitleText": "报名信息"
+				}
 			}]
 		},
 		{

BIN
static/images/select.png


BIN
static/images/select_h.png