find($competitionId); if (! $competition) { $this->command?->warn("Competition {$competitionId} not found, skip."); return; } $purpose = FormSchemaDefinition::PURPOSE_SIGNUP; $nextVersion = (int) FormSchemaDefinition::query() ->where('competition_id', $competition->id) ->where('purpose', $purpose) ->max('version') + 1; $schema = FormSchemaDefinition::query()->create([ 'competition_id' => $competition->id, 'purpose' => $purpose, 'name' => '选手端报名表(与 /c/{slug}/apply 一致)', 'version' => $nextVersion, 'schema_json' => $this->schemaJson(), 'is_published' => true, ]); $competition->update(['form_schema_id' => $schema->id]); $this->command?->info("Form schema #{$schema->id} (v{$nextVersion}) created and bound to competition #{$competitionId}."); } /** * @return list> */ private function schemaJson(): array { $tracks = config('contest.tracks', []); $degrees = config('contest.degrees', []); $countries = config('contest.location_countries', ['中国', '海外']); $trackOptions = array_map(fn (string $t) => ['label' => $t, 'value' => $t], $tracks); $degreeOptions = array_map(fn (string $d) => ['label' => $d, 'value' => $d], $degrees); $countryOptions = array_map(fn (string $c) => ['label' => $c, 'value' => $c], $countries); $provinceOptions = array_map( fn (string $p) => ['label' => $p, 'value' => $p], $this->provinceOrder(), ); return [ [ 'key' => 'project_name', 'type' => 'text', 'label' => '项目名称', 'required' => true, ], [ 'key' => 'player_name', 'type' => 'text', 'label' => '申请人姓名', 'required' => true, ], [ 'key' => 'contact_email', 'type' => 'email', 'label' => '注册邮箱', 'required' => true, ], [ 'key' => 'contact_mobile', 'type' => 'tel', 'label' => '申请人电话', 'required' => true, ], [ 'key' => 'school', 'type' => 'text', 'label' => '毕业院校', 'required' => true, ], [ 'key' => 'degree', 'type' => 'select', 'label' => '最高学历', 'required' => true, 'options' => $degreeOptions, ], [ 'key' => 'track', 'type' => 'select', 'label' => '细分赛道', 'required' => true, 'options' => $trackOptions, ], [ 'key' => 'company_name', 'type' => 'text', 'label' => '企业名称', 'required' => true, 'prefill_from' => 'user.company', ], [ 'key' => 'location_country', 'type' => 'select', 'label' => '项目所在地', 'required' => true, 'options' => $countryOptions, ], [ 'key' => 'location_province', 'type' => 'select', 'label' => '省份', 'required' => false, 'options' => $provinceOptions, 'help' => '选择「中国」时必填', ], [ 'key' => 'location_city', 'type' => 'text', 'label' => '城市', 'required' => false, 'help' => '选择「中国」时填写所在城市', ], [ 'key' => 'oversea_country', 'type' => 'text', 'label' => '所在国', 'required' => false, 'placeholder' => '如:新加坡、日本、美国', 'help' => '选择「海外」时必填', ], [ 'key' => 'event_location', 'type' => 'select', 'label' => '参赛地点', 'required' => true, 'options' => array_map( fn (string $v) => ['label' => $v, 'value' => $v], config('contest.event_locations', ['上海', '苏州', '深圳']), ), ], [ 'key' => 'team_members', 'type' => 'text', 'label' => '团队成员', 'required' => true, 'placeholder' => '多人请用顿号分隔', ], [ 'key' => 'recommend', 'type' => 'text', 'label' => '推荐方', 'required' => false, 'placeholder' => '单位或推荐人名称', ], [ 'key' => 'intro', 'type' => 'textarea', 'label' => '项目简介', 'required' => true, 'placeholder' => '约200字左右', ], [ 'key' => 'commitment_accepted', 'type' => 'checkbox', 'label' => '参赛承诺书', 'required' => true, 'help' => '请点击按钮打开承诺书全文,阅读后在文末手写签名并点击「确认签署」。', ], [ 'key' => 'plan', 'type' => 'file', 'label' => '上传商业计划书', 'required' => true, 'help' => '包括企业概况与定位、核心产品/服务、市场规模和竞争情况、创新壁垒与差异化优势、核心团队介绍与优势、未来发展战略规划等,PDF格式,建议不超过20页。', 'file_extensions' => ['pdf'], 'file_max_count' => 1, ], [ 'key' => 'supporting', 'type' => 'file', 'label' => '其他佐证材料', 'required' => false, 'help' => '可上传多个文件:企业营业执照扫描件;知识产权相关证明材料(专利证书、商标注册证、软件著作权等),其他佐证材料(产品或服务介绍、获奖证书、投融资证明等)、创始人或主要负责人学历学位等资质证明。单文件 20M 以内,支持:PDF、PPT、PPTX、DOC、DOCX、WPS、RAR、ZIP', ], ]; } /** * 与前端 src/data/chinaRegion.ts provinceOrder 一致。 * * @return list */ private function provinceOrder(): array { return [ '北京市', '天津市', '上海市', '重庆市', '河北省', '山西省', '内蒙古自治区', '辽宁省', '吉林省', '黑龙江省', '江苏省', '浙江省', '安徽省', '福建省', '江西省', '山东省', '河南省', '湖北省', '湖南省', '广东省', '广西壮族自治区', '海南省', '四川省', '贵州省', '云南省', '西藏自治区', '陕西省', '甘肃省', '青海省', '宁夏回族自治区', '新疆维吾尔自治区', '香港特别行政区', '澳门特别行政区', '台湾省', ]; } }