forked from Gitlink/forgeplus-react
定制化竞赛路由动态化1.0
This commit is contained in:
parent
4a56895be2
commit
d8c06883b4
|
@ -1,8 +1,8 @@
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
// 用户参与启智2022状态?debug=teacher
|
// 用户参与启智2022状态?debug=teacher
|
||||||
export async function userCompetitionStatus(id) {
|
export async function userCompetitionStatus(competitionId) {
|
||||||
return axios.get(`/competition_infos/${id}/enroll_status.json`);
|
return axios.get(`/competition_infos/${competitionId}/enroll_status.json`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 启智2022详情接口
|
// 启智2022详情接口
|
||||||
|
@ -11,13 +11,13 @@ export function getQz2022(competitionId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 报名启智2022 竞赛?debug=teacher
|
// 报名启智2022 竞赛?debug=teacher
|
||||||
export async function enrollCompetition(data){
|
export async function enrollCompetition(data,competitionId){
|
||||||
return axios.post(`/competition_infos/qz2022/enroll.json`,data);
|
return axios.post(`/competition_infos/${competitionId}/enroll.json`,data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改报名信息
|
// 修改报名信息
|
||||||
export async function enrollUpdate(data){
|
export async function enrollUpdate(data,competitionId){
|
||||||
return axios.post(`/competition_infos/qz2022/enroll_update.json`,data);
|
return axios.post(`/competition_infos/${competitionId}/enroll_update.json`,data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 统计启智2022 竞赛
|
// 统计启智2022 竞赛
|
||||||
|
@ -26,48 +26,48 @@ export async function stattistics(competitionId){
|
||||||
}
|
}
|
||||||
|
|
||||||
// 竞赛提交作品
|
// 竞赛提交作品
|
||||||
export async function uploadCompetition(data){
|
export async function uploadCompetition(data,competitionId){
|
||||||
return axios.post(`/competition_infos/qz2022/upload.json`,data);
|
return axios.post(`/competition_infos/${competitionId}/upload.json`,data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 管理-竞赛报名列表?debug=admin
|
// 管理-竞赛报名列表?debug=admin
|
||||||
export function getQzEnrollList(params) {
|
export function getQzEnrollList(params,competitionId) {
|
||||||
return axios.get(`/competition_infos/qz2022/enroll_list.json`,params={params});
|
return axios.get(`/competition_infos/${competitionId}/enroll_list.json`,params={params});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 管理-竞赛提交作品列表&debug=admin
|
// 管理-竞赛提交作品列表&debug=admin
|
||||||
export function getQzProList(params) {
|
export function getQzProList(params,competitionId) {
|
||||||
return axios.get(`/competition_infos/qz2022/enroll_list.json?upload=true`,params={params});
|
return axios.get(`/competition_infos/${competitionId}/enroll_list.json?upload=true`,params={params});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通知公告列表
|
// 通知公告列表
|
||||||
export function getNoticeList() {
|
export function getNoticeList(competitionId) {
|
||||||
return axios.get(`/competition_infos/qz2022/competition_notices.json`);
|
return axios.get(`/competition_infos/${competitionId}/competition_notices.json`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通知公告详情
|
// 通知公告详情
|
||||||
export function getNoticeDetail(id) {
|
export function getNoticeDetail(id,competitionId) {
|
||||||
return axios.get(`/competition_infos/qz2022/competition_notices/${id}.json`);
|
return axios.get(`/competition_infos/${competitionId}/competition_notices/${id}.json`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增通知
|
// 新增通知
|
||||||
export async function addQz2022Notice(data){
|
export async function addQz2022Notice(data,competitionId){
|
||||||
return axios.post(`/competition_infos/qz2022/competition_notices.json`,data);
|
return axios.post(`/competition_infos/${competitionId}/competition_notices.json`,data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑通知
|
// 编辑通知
|
||||||
export async function updateQz2022Notice(id,data){
|
export async function updateQz2022Notice(id,data,competitionId){
|
||||||
return axios.put(`/competition_infos/qz2022/competition_notices/${id}.json`,data);
|
return axios.put(`/competition_infos/${competitionId}/competition_notices/${id}.json`,data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除通知
|
// 删除通知
|
||||||
export async function deleteQz2022Notice(id){
|
export async function deleteQz2022Notice(id,competitionId){
|
||||||
return axios.delete(`/competition_infos/qz2022/competition_notices/${id}.json`);
|
return axios.delete(`/competition_infos/${competitionId}/competition_notices/${id}.json`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑大赛介绍、大赛指南、关于我
|
// 编辑大赛介绍、大赛指南、关于我
|
||||||
export async function updateQz2022(data){
|
export async function updateQz2022(data,competitionId){
|
||||||
return axios.put(`/competition_infos/qz2022.json`,data);
|
return axios.put(`/competition_infos/${competitionId}.json`,data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改竞赛报名状态
|
// 修改竞赛报名状态
|
||||||
|
|
|
@ -18,7 +18,9 @@ import { useEffect } from "react";
|
||||||
const Option = Select.Option;
|
const Option = Select.Option;
|
||||||
|
|
||||||
export default Form.create()((props) => {
|
export default Form.create()((props) => {
|
||||||
const {form, qzDetail, enrollStatus, setReload, current_user, history} = props;
|
const {form, qzDetail, enrollStatus, setReload, current_user, history,match} = props;
|
||||||
|
const { competitionId } = match.params;
|
||||||
|
|
||||||
const {getFieldDecorator, validateFields, setFieldsValue} = form;
|
const {getFieldDecorator, validateFields, setFieldsValue} = form;
|
||||||
const [members, setMembers] = useState([]);
|
const [members, setMembers] = useState([]);
|
||||||
const [errorMessage, setErrorMessage] = useState(undefined);
|
const [errorMessage, setErrorMessage] = useState(undefined);
|
||||||
|
@ -30,7 +32,7 @@ export default Form.create()((props) => {
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
const applyStatus = qzDetail ? Date.parse(new Date()) < Date.parse(new Date(qzDetail.enroll_date)) : true;
|
const applyStatus = qzDetail ? Date.parse(new Date()) < Date.parse(new Date(qzDetail.enroll_date)) : true;
|
||||||
if((current_user && !current_user.login) || !applyStatus){
|
if((current_user && !current_user.login) || !applyStatus){
|
||||||
history.push("/competition/qz2022");
|
history.push(`/competition/${competitionId}`);
|
||||||
}
|
}
|
||||||
if(enrollStatus && enrollStatus.enroll_status && enrollStatus.status === 0){
|
if(enrollStatus && enrollStatus.enroll_status && enrollStatus.status === 0){
|
||||||
setMembers(enrollStatus.enroll_info.members);
|
setMembers(enrollStatus.enroll_info.members);
|
||||||
|
@ -114,7 +116,7 @@ export default Form.create()((props) => {
|
||||||
}
|
}
|
||||||
// enrollStatus.enroll_status判断用户是首次提交资料还是修改资料
|
// enrollStatus.enroll_status判断用户是首次提交资料还是修改资料
|
||||||
if(enrollStatus && !enrollStatus.enroll_status){
|
if(enrollStatus && !enrollStatus.enroll_status){
|
||||||
enrollCompetition(params).then(response=>{
|
enrollCompetition(params,competitionId).then(response=>{
|
||||||
if(response && response.data.message === "success"){
|
if(response && response.data.message === "success"){
|
||||||
setReload(Math.random());
|
setReload(Math.random());
|
||||||
message.success('报名成功')
|
message.success('报名成功')
|
||||||
|
@ -124,7 +126,7 @@ export default Form.create()((props) => {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
enrollUpdate(params).then(response=>{
|
enrollUpdate(params,competitionId).then(response=>{
|
||||||
if(response && response.data.message === "success"){
|
if(response && response.data.message === "success"){
|
||||||
setReload(Math.random());
|
setReload(Math.random());
|
||||||
message.success('资料修改成功');
|
message.success('资料修改成功');
|
||||||
|
@ -183,7 +185,7 @@ export default Form.create()((props) => {
|
||||||
if(files.length === 0){
|
if(files.length === 0){
|
||||||
message.error("请先上传报名表扫描件");
|
message.error("请先上传报名表扫描件");
|
||||||
}else{
|
}else{
|
||||||
updateTemplate({enroll_template_id: files[0].response.id}).then(response=>{
|
updateTemplate({enroll_template_id: files[0].response.id},competitionId).then(response=>{
|
||||||
if(response && response.data.message === "success"){
|
if(response && response.data.message === "success"){
|
||||||
setReload(Math.random());
|
setReload(Math.random());
|
||||||
message.success('报名表扫描件上传成功');
|
message.success('报名表扫描件上传成功');
|
||||||
|
|
|
@ -40,7 +40,6 @@ function QzModal() {
|
||||||
>
|
>
|
||||||
<img src={bg} />
|
<img src={bg} />
|
||||||
|
|
||||||
{/* <Link to="/competition/qz2022/notice" className="qz-btn">查看详情</Link> */}
|
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import '../notice/index.scss';
|
||||||
import '../notice/detail.scss';
|
import '../notice/detail.scss';
|
||||||
|
|
||||||
export default Form.create()((props) => {
|
export default Form.create()((props) => {
|
||||||
const {form, history, match:{params:{type}}, qzDetail, setReloadDetail, current_user} = props;
|
const {form, history, match:{params:{type,competitionId}}, qzDetail, setReloadDetail, current_user} = props;
|
||||||
const {getFieldDecorator, validateFields, setFieldsValue } = form;
|
const {getFieldDecorator, validateFields, setFieldsValue } = form;
|
||||||
const [description, setDescription] = useState(qzDetail && type === "introduce" ? (qzDetail && qzDetail.content) : type === "fingerpost" ? (qzDetail && qzDetail.guide) : (qzDetail && qzDetail.about_us));
|
const [description, setDescription] = useState(qzDetail && type === "introduce" ? (qzDetail && qzDetail.content) : type === "fingerpost" ? (qzDetail && qzDetail.guide) : (qzDetail && qzDetail.about_us));
|
||||||
const [errorMessage, setErrorMessage] = useState(undefined);
|
const [errorMessage, setErrorMessage] = useState(undefined);
|
||||||
|
@ -43,11 +43,11 @@ export default Form.create()((props) => {
|
||||||
const params = {
|
const params = {
|
||||||
'competition_info': info,
|
'competition_info': info,
|
||||||
}
|
}
|
||||||
updateQz2022(params).then(response=>{
|
updateQz2022(params,competitionId).then(response=>{
|
||||||
if(response && response.data.message === "success"){
|
if(response && response.data.message === "success"){
|
||||||
setReloadDetail(Math.random());
|
setReloadDetail(Math.random());
|
||||||
message.success('更新成功');
|
message.success('更新成功');
|
||||||
history.push(`/competition/qz2022/${type}`);
|
history.push(`/competition/${competitionId}/${type}`);
|
||||||
}else{
|
}else{
|
||||||
message.error(response.message);
|
message.error(response.message);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ export default Form.create()((props) => {
|
||||||
<div className="qz_main notice_detal qz2022_notice_edit">
|
<div className="qz_main notice_detal qz2022_notice_edit">
|
||||||
<div className="breadCrumb mb20">
|
<div className="breadCrumb mb20">
|
||||||
<img src={icon} className="mr12 icon_d" alt=""/>
|
<img src={icon} className="mr12 icon_d" alt=""/>
|
||||||
<Link to={`/competition/qz2022/${type}`}><span className="font-16 _999">{type === "introduce" ? "首页" : type === "fingerpost" ? "大赛指南" : "联系我们"}</span></Link>
|
<Link to={`/competition/${competitionId}/${type}`}><span className="font-16 _999">{type === "introduce" ? "首页" : type === "fingerpost" ? "大赛指南" : "联系我们"}</span></Link>
|
||||||
<span className="mr10 ml10 _999">/</span>
|
<span className="mr10 ml10 _999">/</span>
|
||||||
<span className="font-16 _18">编辑</span>
|
<span className="font-16 _18">编辑</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -89,7 +89,7 @@ export default Form.create()((props) => {
|
||||||
</Form>
|
</Form>
|
||||||
<div className="qz2022_notice_but">
|
<div className="qz2022_notice_but">
|
||||||
<Button className="mr30" type="primary" onClick={submit}>提交</Button>
|
<Button className="mr30" type="primary" onClick={submit}>提交</Button>
|
||||||
<Button onClick={()=>{history.push(`/competition/qz2022/${type}`);}}>取消</Button>
|
<Button onClick={()=>{history.push(`/competition/${competitionId}/${type}`);}}>取消</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,14 +6,15 @@ import { Button } from "antd";
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
import '../../index.scss';
|
import '../../index.scss';
|
||||||
|
|
||||||
function Contact({ aboutUs, qzDetail, current_user }) {
|
function Contact({ aboutUs, qzDetail, current_user,match }) {
|
||||||
const manageEdit = (qzDetail && qzDetail.is_manager) || (current_user && current_user.admin);
|
const manageEdit = (qzDetail && qzDetail.is_manager) || (current_user && current_user.admin);
|
||||||
const is_local= qzDetail &&qzDetail.is_local;
|
const is_local= qzDetail &&qzDetail.is_local;
|
||||||
console.log(is_local);
|
const { competitionId } = match.params;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="contact-bg">
|
<div className="contact-bg">
|
||||||
{manageEdit && <div className="qz_main manageEdit mb20">
|
{manageEdit && <div className="qz_main manageEdit mb20">
|
||||||
<Link to={"/competition/qz2022/contact/edit"}><Button><i className="iconfont icon-a-bianji11 font-13 mr5"></i>编辑</Button></Link>
|
<Link to={`/competition/${competitionId}/contact/edit`}><Button><i className="iconfont icon-a-bianji11 font-13 mr5"></i>编辑</Button></Link>
|
||||||
</div>}
|
</div>}
|
||||||
<div className="contact qz_main">
|
<div className="contact qz_main">
|
||||||
{ !is_local&&<img className="contact-png" src={contactPng} alt=""></img>}
|
{ !is_local&&<img className="contact-png" src={contactPng} alt=""></img>}
|
||||||
|
|
|
@ -6,12 +6,14 @@ import { Button } from "antd";
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
import '../index.scss';
|
import '../index.scss';
|
||||||
|
|
||||||
function Introduce({ qzDetail, current_user}) {
|
function Introduce({ qzDetail, current_user,match}) {
|
||||||
const manageEdit = (qzDetail && qzDetail.is_manager) || (current_user && current_user.admin);
|
const manageEdit = (qzDetail && qzDetail.is_manager) || (current_user && current_user.admin);
|
||||||
|
const { competitionId } = match.params;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="fingerpost">
|
<div className="fingerpost">
|
||||||
{manageEdit && <div className="qz_main manageEdit mb15">
|
{manageEdit && <div className="qz_main manageEdit mb15">
|
||||||
<Link to={"/competition/qz2022/fingerpost/edit"}><Button><i className="iconfont icon-a-bianji11 font-13 mr5"></i>编辑</Button></Link>
|
<Link to={`/competition/${competitionId}/fingerpost/edit`}><Button><i className="iconfont icon-a-bianji11 font-13 mr5"></i>编辑</Button></Link>
|
||||||
</div>}
|
</div>}
|
||||||
<RenderHtml value={qzDetail && qzDetail.guide} className="fingerpost_cont qz_main"/>
|
<RenderHtml value={qzDetail && qzDetail.guide} className="fingerpost_cont qz_main"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,7 +6,9 @@ import './index.scss';
|
||||||
import '../index.scss';
|
import '../index.scss';
|
||||||
import RenderHtml from "src/components/render-html";
|
import RenderHtml from "src/components/render-html";
|
||||||
|
|
||||||
function Introduce({ qzDetail, current_user }) {
|
function Introduce({ qzDetail, current_user,match }) {
|
||||||
|
const { competitionId } = match.params;
|
||||||
|
|
||||||
const manageEdit = (qzDetail && qzDetail.is_manager) || (current_user && current_user.admin);
|
const manageEdit = (qzDetail && qzDetail.is_manager) || (current_user && current_user.admin);
|
||||||
let content= qzDetail&&qzDetail.content;
|
let content= qzDetail&&qzDetail.content;
|
||||||
let video_url= qzDetail&&qzDetail.video_url;
|
let video_url= qzDetail&&qzDetail.video_url;
|
||||||
|
@ -14,7 +16,7 @@ function Introduce({ qzDetail, current_user }) {
|
||||||
return (
|
return (
|
||||||
<div className="introduce_bg">
|
<div className="introduce_bg">
|
||||||
{manageEdit && <div className="qz_main manageEdit">
|
{manageEdit && <div className="qz_main manageEdit">
|
||||||
<Link to={"/competition/qz2022/introduce/edit"}><Button><i className="iconfont icon-a-bianji11 font-13 mr5"></i>编辑</Button></Link>
|
<Link to={`/competition/${competitionId}/introduce/edit`}><Button><i className="iconfont icon-a-bianji11 font-13 mr5"></i>编辑</Button></Link>
|
||||||
</div>}
|
</div>}
|
||||||
<div className="introduce">
|
<div className="introduce">
|
||||||
<div className="introduce-content clearfix">
|
<div className="introduce-content clearfix">
|
||||||
|
|
|
@ -10,7 +10,8 @@ import { getQzEnrollList, getQzProList, updateEnroll } from "../api.js";
|
||||||
const Option = Select.Option;
|
const Option = Select.Option;
|
||||||
const {Search} = Input;
|
const {Search} = Input;
|
||||||
|
|
||||||
function Introduce({history:{location:{pathname}},qzDetail }) {
|
function Introduce({history:{location:{pathname}},qzDetail,match }) {
|
||||||
|
const { competitionId } = match.params;
|
||||||
// 报名列表和作品列表到指向此处,type做区分,0报名,1作品
|
// 报名列表和作品列表到指向此处,type做区分,0报名,1作品
|
||||||
const [type, setType] = useState(pathname.substring(pathname.lastIndexOf('/')+1, pathname.lenght));
|
const [type, setType] = useState(pathname.substring(pathname.lastIndexOf('/')+1, pathname.lenght));
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
@ -44,7 +45,7 @@ function Introduce({history:{location:{pathname}},qzDetail }) {
|
||||||
}
|
}
|
||||||
if(type === "applys"){
|
if(type === "applys"){
|
||||||
// 报名列表
|
// 报名列表
|
||||||
getQzEnrollList(params).then(response=>{
|
getQzEnrollList(params,competitionId).then(response=>{
|
||||||
if(response && response.status === 200){
|
if(response && response.status === 200){
|
||||||
setTotal(response.data.count);
|
setTotal(response.data.count);
|
||||||
setDataList(response.data.data);
|
setDataList(response.data.data);
|
||||||
|
@ -54,7 +55,7 @@ function Introduce({history:{location:{pathname}},qzDetail }) {
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
// 提交作品列表
|
// 提交作品列表
|
||||||
getQzProList(params).then(response=>{
|
getQzProList(params,competitionId).then(response=>{
|
||||||
if(response && response.status === 200){
|
if(response && response.status === 200){
|
||||||
setTotal(response.data.count);
|
setTotal(response.data.count);
|
||||||
setDataList(response.data.data);
|
setDataList(response.data.data);
|
||||||
|
@ -71,7 +72,7 @@ function Introduce({history:{location:{pathname}},qzDetail }) {
|
||||||
user_id: userId,
|
user_id: userId,
|
||||||
status: index
|
status: index
|
||||||
}
|
}
|
||||||
updateEnroll(params).then(response=>{
|
updateEnroll(params,competitionId).then(response=>{
|
||||||
if(response && response.status === 200){
|
if(response && response.status === 200){
|
||||||
setReload(Math.random());
|
setReload(Math.random());
|
||||||
message.success("操作成功");
|
message.success("操作成功");
|
||||||
|
@ -277,9 +278,9 @@ function Introduce({history:{location:{pathname}},qzDetail }) {
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{type === "applys" && <a href={current_main_site_url+`/api/competition_infos/qz2022/enroll_template.zip`}><Button className="but_2e5 ml10">导出报名表扫描件</Button></a>}
|
{type === "applys" && <a href={current_main_site_url+`/api/competition_infos/${competitionId}/enroll_template.zip`}><Button className="but_2e5 ml10">导出报名表扫描件</Button></a>}
|
||||||
{type === "production" && <a href={current_main_site_url+`/api/competition_infos/qz2022/enroll_list.zip?upload=true`}><Button className="but_2e5 ml10">导出作品文件</Button></a>}
|
{type === "production" && <a href={current_main_site_url+`/api/competition_infos/${competitionId}/enroll_list.zip?upload=true`}><Button className="but_2e5 ml10">导出作品文件</Button></a>}
|
||||||
<a href={current_main_site_url+`/api/competition_infos/qz2022/enroll_list.xlsx${type === "applys"? '':"?upload=true"}`}><Button className="but_2e5 ml10">导出{type === "applys" ? '报名信息' : '作品信息'}</Button></a>
|
<a href={current_main_site_url+`/api/competition_infos/${competitionId}/enroll_list.xlsx${type === "applys"? '':"?upload=true"}`}><Button className="but_2e5 ml10">导出{type === "applys" ? '报名信息' : '作品信息'}</Button></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import './detail.scss';
|
||||||
import { getNoticeDetail, addQz2022Notice, updateQz2022Notice } from "../api";
|
import { getNoticeDetail, addQz2022Notice, updateQz2022Notice } from "../api";
|
||||||
|
|
||||||
export default Form.create()((props) => {
|
export default Form.create()((props) => {
|
||||||
const {form, history, match:{params:{noticeId,type}}, current_user, qzDetail} = props;
|
const {form, history, match:{params:{noticeId,type,competitionId}}, current_user, qzDetail} = props;
|
||||||
const {getFieldDecorator, validateFields, setFieldsValue } = form;
|
const {getFieldDecorator, validateFields, setFieldsValue } = form;
|
||||||
const [description, setDescription] = useState(undefined);
|
const [description, setDescription] = useState(undefined);
|
||||||
const [errorMessage, setErrorMessage] = useState(undefined);
|
const [errorMessage, setErrorMessage] = useState(undefined);
|
||||||
|
@ -22,7 +22,7 @@ export default Form.create()((props) => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(noticeId && type === "edit"){
|
if(noticeId && type === "edit"){
|
||||||
getNoticeDetail(noticeId).then(response=>{
|
getNoticeDetail(noticeId,competitionId).then(response=>{
|
||||||
if(response && response.data.message === "success"){
|
if(response && response.data.message === "success"){
|
||||||
setDescription(response.data.data.content);
|
setDescription(response.data.data.content);
|
||||||
setFieldsValue({title: response.data.data.title});
|
setFieldsValue({title: response.data.data.title});
|
||||||
|
@ -47,18 +47,18 @@ export default Form.create()((props) => {
|
||||||
...values,
|
...values,
|
||||||
content: description
|
content: description
|
||||||
}
|
}
|
||||||
type === "add" && addQz2022Notice(params).then(response=>{
|
type === "add" && addQz2022Notice(params,competitionId).then(response=>{
|
||||||
if(response && response.data.message === "success"){
|
if(response && response.data.message === "success"){
|
||||||
message.success('新增成功');
|
message.success('新增成功');
|
||||||
history.push('/competition/qz2022/notice');
|
history.push(`/competition/${competitionId}/notice`);
|
||||||
}else{
|
}else{
|
||||||
message.error(response.data.message);
|
message.error(response.data.message);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
type === "edit" && updateQz2022Notice(noticeId,params).then(response=>{
|
type === "edit" && updateQz2022Notice(noticeId,params,competitionId).then(response=>{
|
||||||
if(response && response.data.message === "success"){
|
if(response && response.data.message === "success"){
|
||||||
message.success('修改成功');
|
message.success('修改成功');
|
||||||
history.push('/competition/qz2022/notice');
|
history.push('/competition/${competitionId}/notice');
|
||||||
}else{
|
}else{
|
||||||
message.error(response.data.message);
|
message.error(response.data.message);
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ export default Form.create()((props) => {
|
||||||
<div className="qz_main notice_detal pt30">
|
<div className="qz_main notice_detal pt30">
|
||||||
<div className="breadCrumb">
|
<div className="breadCrumb">
|
||||||
<img src={icon} className="mr12 icon_d" alt=""/>
|
<img src={icon} className="mr12 icon_d" alt=""/>
|
||||||
<Link to={"/competition/qz2022/notice"}><span className="font-16 _999">通知公告</span></Link>
|
<Link to={`/competition/${competitionId}/notice`}><span className="font-16 _999">通知公告</span></Link>
|
||||||
<span className="mr10 ml10 _999">/</span>
|
<span className="mr10 ml10 _999">/</span>
|
||||||
<span className="font-16 _18">{type === 'add' ? '新增' : '编辑'}</span>
|
<span className="font-16 _18">{type === 'add' ? '新增' : '编辑'}</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -100,7 +100,7 @@ export default Form.create()((props) => {
|
||||||
</Form>
|
</Form>
|
||||||
<div className="qz2022_notice_but">
|
<div className="qz2022_notice_but">
|
||||||
<Button className="mr30" type="primary" onClick={submit}>提交</Button>
|
<Button className="mr30" type="primary" onClick={submit}>提交</Button>
|
||||||
<Button onClick={()=>{history.push('/competition/qz2022/notice');}}>取消</Button>
|
<Button onClick={()=>{history.push(`/competition/${competitionId}/notice`);}}>取消</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,11 +7,11 @@ import './detail.scss';
|
||||||
import { getNoticeDetail } from "../api";
|
import { getNoticeDetail } from "../api";
|
||||||
import RenderHtml from "src/components/render-html";
|
import RenderHtml from "src/components/render-html";
|
||||||
|
|
||||||
function NoticeDetail({match:{params:{noticeId}}, history}) {
|
function NoticeDetail({ match: { params: { noticeId, competitionId } }, history }) {
|
||||||
const [detail, setDetail] = useState(undefined);
|
const [detail, setDetail] = useState(undefined);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
noticeId && getNoticeDetail(noticeId).then(response=>{
|
noticeId && getNoticeDetail(noticeId, competitionId).then(response => {
|
||||||
if (response && response.data.message === "success") {
|
if (response && response.data.message === "success") {
|
||||||
setDetail(response.data.data);
|
setDetail(response.data.data);
|
||||||
} else {
|
} else {
|
||||||
|
@ -25,7 +25,7 @@ function NoticeDetail({match:{params:{noticeId}}, history}) {
|
||||||
<div className="qz_main notice_detal pt30">
|
<div className="qz_main notice_detal pt30">
|
||||||
<div className="breadCrumb">
|
<div className="breadCrumb">
|
||||||
<img src={icon} className="mr12 icon_d" alt="" />
|
<img src={icon} className="mr12 icon_d" alt="" />
|
||||||
<Link to={"/competition/qz2022/notice"}><span className="font-16 _999">通知公告</span></Link>
|
<Link to={`/competition/${competitionId}/notice`}><span className="font-16 _999">通知公告</span></Link>
|
||||||
<span className="mr10 ml10 _999">/</span>
|
<span className="mr10 ml10 _999">/</span>
|
||||||
<span className="font-16 _18">公告详情</span>
|
<span className="font-16 _18">公告详情</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,13 +7,14 @@ import '../../index.scss';
|
||||||
import { getNoticeList, deleteQz2022Notice } from "../api";
|
import { getNoticeList, deleteQz2022Notice } from "../api";
|
||||||
import RenderHtml from "src/components/render-html";
|
import RenderHtml from "src/components/render-html";
|
||||||
|
|
||||||
function Notice({ current_user, qzDetail }) {
|
function Notice({ current_user, qzDetail,match }) {
|
||||||
|
const { competitionId } = match.params;
|
||||||
const manageEdit = (qzDetail && qzDetail.is_manager) || (current_user && current_user.admin);
|
const manageEdit = (qzDetail && qzDetail.is_manager) || (current_user && current_user.admin);
|
||||||
const [noticeList, setNoticeList] = useState([]);
|
const [noticeList, setNoticeList] = useState([]);
|
||||||
const [reload, setReload] = useState(undefined);
|
const [reload, setReload] = useState(undefined);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getNoticeList().then(response => {
|
getNoticeList(competitionId).then(response => {
|
||||||
if (response.status === 200 && response.data.message === "success") {
|
if (response.status === 200 && response.data.message === "success") {
|
||||||
setNoticeList(response.data.data);
|
setNoticeList(response.data.data);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +26,7 @@ function Notice({ current_user, qzDetail }) {
|
||||||
title: "是否删除",
|
title: "是否删除",
|
||||||
content: "确定删除此通知公告?",
|
content: "确定删除此通知公告?",
|
||||||
onOk() {
|
onOk() {
|
||||||
deleteQz2022Notice(id).then(response => {
|
deleteQz2022Notice(id,competitionId).then(response => {
|
||||||
if (response.status === 200 && response.data.message === "success") {
|
if (response.status === 200 && response.data.message === "success") {
|
||||||
setReload(Math.random());
|
setReload(Math.random());
|
||||||
message.success("删除成功");
|
message.success("删除成功");
|
||||||
|
@ -38,16 +39,16 @@ function Notice({ current_user, qzDetail }) {
|
||||||
return (
|
return (
|
||||||
<div className="qz_notice bg">
|
<div className="qz_notice bg">
|
||||||
{manageEdit && <div className="qz_main manageEdit mt30">
|
{manageEdit && <div className="qz_main manageEdit mt30">
|
||||||
<Link to={"/competition/qz2022/notice/add"}><Button>新增公告</Button></Link>
|
<Link to={`/competition/${competitionId}/notice/add`}><Button>新增公告</Button></Link>
|
||||||
</div>}
|
</div>}
|
||||||
<div className="qz_main not">
|
<div className="qz_main not">
|
||||||
{noticeList && noticeList.map(item => {
|
{noticeList && noticeList.map(item => {
|
||||||
return <div className="qz_notice_cont" key={item.id}>
|
return <div className="qz_notice_cont" key={item.id}>
|
||||||
<div className="head">
|
<div className="head">
|
||||||
<Link to={`/competition/qz2022/notice/detail/${item.id}`} className="notCont_head"><img className="notice-new" src={notice} alt=""/>{item.title}</Link>
|
<Link to={`/competition/${competitionId}/notice/detail/${item.id}`} className="notCont_head"><img className="notice-new" src={notice} alt=""/>{item.title}</Link>
|
||||||
{manageEdit && <Popover content={<Menu>
|
{manageEdit && <Popover content={<Menu>
|
||||||
<Menu.Item>
|
<Menu.Item>
|
||||||
<Link to={`/competition/qz2022/notice/edit/${item.id}`}>编辑</Link>
|
<Link to={`/competition/${competitionId}/notice/edit/${item.id}`}>编辑</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item>
|
<Menu.Item>
|
||||||
<a onClick={() => { deleteNotice(item.id) }}>删除</a>
|
<a onClick={() => { deleteNotice(item.id) }}>删除</a>
|
||||||
|
|
|
@ -11,6 +11,7 @@ import '../../index.scss';
|
||||||
import '../apply/index.scss';
|
import '../apply/index.scss';
|
||||||
|
|
||||||
function Introduce({ form, showNotification, match, history, enrollStatus, current_user, qzDetail, setReload}) {
|
function Introduce({ form, showNotification, match, history, enrollStatus, current_user, qzDetail, setReload}) {
|
||||||
|
const { competitionId } = match.params;
|
||||||
// 上传文件时 按钮loading效果
|
// 上传文件时 按钮loading效果
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [files, setFiles] = useState();
|
const [files, setFiles] = useState();
|
||||||
|
@ -29,7 +30,7 @@ function Introduce({ form, showNotification, match, history, enrollStatus, curre
|
||||||
const referStatus = qzDetail && !(Date.parse(new Date()) > Date.parse(new Date(qzDetail.enroll_date)) && Date.parse(new Date()) < Date.parse(new Date(qzDetail.upload_date)));
|
const referStatus = qzDetail && !(Date.parse(new Date()) > Date.parse(new Date(qzDetail.enroll_date)) && Date.parse(new Date()) < Date.parse(new Date(qzDetail.upload_date)));
|
||||||
// 当前时间不处于提案提交时间 或者用户未登录情况下 或者用户未报名 通过URL访问此页面,跳转到大赛介绍页面 或者用户报名信息被驳回未处理(enrollStatus.status = 0)
|
// 当前时间不处于提案提交时间 或者用户未登录情况下 或者用户未报名 通过URL访问此页面,跳转到大赛介绍页面 或者用户报名信息被驳回未处理(enrollStatus.status = 0)
|
||||||
if(referStatus || (current_user && !current_user.login) || (enrollStatus && (!enrollStatus.enroll_status || enrollStatus.status === 0))){
|
if(referStatus || (current_user && !current_user.login) || (enrollStatus && (!enrollStatus.enroll_status || enrollStatus.status === 0))){
|
||||||
history.push("/competition/qz2022");
|
history.push(`/competition/${competitionId}`);
|
||||||
}
|
}
|
||||||
},[qzDetail, current_user, enrollStatus])
|
},[qzDetail, current_user, enrollStatus])
|
||||||
|
|
||||||
|
@ -80,7 +81,7 @@ function Introduce({ form, showNotification, match, history, enrollStatus, curre
|
||||||
const params = {
|
const params = {
|
||||||
"attachment_ids": [files[0].response.id]
|
"attachment_ids": [files[0].response.id]
|
||||||
}
|
}
|
||||||
uploadCompetition(params).then(response=>{
|
uploadCompetition(params,competitionId).then(response=>{
|
||||||
if(response && response.status === 200){
|
if(response && response.status === 200){
|
||||||
setChangeFiles(false);
|
setChangeFiles(false);
|
||||||
setReload(Math.random());
|
setReload(Math.random());
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
|
|
||||||
// 启智2022所有的路由后缀
|
// 启智2022所有的路由后缀
|
||||||
export const paths = ["qz2022","introduce", "fingerpost", "notice", "apply", "refer", "statistics", "chat", "contact", "applys", "production",""]
|
export const paths = ["qz2022","CCKS","ccks","introduce", "fingerpost", "notice", "apply", "refer", "statistics", "chat", "contact", "applys", "production",""]
|
Loading…
Reference in New Issue