| | |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | |
| | | |
| | | @NotNull(message = "请选择是否首页推荐") |
| | | private Integer isHomeRecommend; |
| | | |
| | | @NotNull(message = "请输入排序") |
| | | @Min(value = 0, message = "排序不能小于0") |
| | | private Integer sort; |
| | | } |
| | |
| | | HealthPopularization item = new HealthPopularization(); |
| | | fillEntity(item, req); |
| | | item.setClickCount(0); |
| | | item.setSort(0); |
| | | item.setDeleted(0); |
| | | healthPopularizationMapper.insert(item); |
| | | return detail(item.getId()); |
| | |
| | | item.setContentType(contentType); |
| | | item.setStatus(req.getStatus()); |
| | | item.setIsHomeRecommend(req.getIsHomeRecommend()); |
| | | item.setSort(req.getSort()); |
| | | if (contentType == HealthPopularization.CONTENT_TYPE_ARTICLE) { |
| | | String content = trimToNull(req.getContent()); |
| | | if (content == null) { |
| | |
| | | vo.setTitle(item.getTitle()); |
| | | vo.setCoverImg(item.getCoverImg()); |
| | | vo.setClickCount(defaultNumber(item.getClickCount())); |
| | | vo.setSort(defaultNumber(item.getSort())); |
| | | vo.setContentType(item.getContentType()); |
| | | vo.setStatus(item.getStatus()); |
| | | vo.setIsHomeRecommend(item.getIsHomeRecommend()); |
| | |
| | | private String title; |
| | | private String coverImg; |
| | | private Integer clickCount; |
| | | private Integer sort; |
| | | private Integer contentType; |
| | | private Integer status; |
| | | private Integer isHomeRecommend; |
| | |
| | | title: string; |
| | | coverImg?: string; |
| | | clickCount?: number; |
| | | sort?: number; |
| | | contentType: number; |
| | | status: number; |
| | | createdAt: string; |
| | |
| | | render: (value) => value || 0, |
| | | }, |
| | | { |
| | | title: '排序', |
| | | dataIndex: 'sort', |
| | | width: 100, |
| | | render: (value) => value ?? 0, |
| | | }, |
| | | { |
| | | title: '类型', |
| | | dataIndex: 'contentType', |
| | | width: 100, |
| | |
| | | import BraftEditorCom from '@/components/BraftEditor'; |
| | | import { PlusOutlined } from '@ant-design/icons'; |
| | | import { history, useAccess } from '@umijs/max'; |
| | | import { Button, Form, Image, Input, Switch, Upload, message } from 'antd'; |
| | | import { Button, Form, Image, Input, InputNumber, Switch, Upload, message } from 'antd'; |
| | | import React, { useEffect, useMemo, useState } from 'react'; |
| | | import './style.less'; |
| | | |
| | |
| | | form.setFieldsValue({ |
| | | title: '', |
| | | content: '', |
| | | sort: 0, |
| | | status: true, |
| | | isHomeRecommend: true, |
| | | }); |
| | |
| | | title: detail.title, |
| | | coverImg: detail.coverImg, |
| | | content: detail.content || '', |
| | | sort: detail.sort ?? 0, |
| | | status: detail.status === 1, |
| | | isHomeRecommend: detail.isHomeRecommend === 1, |
| | | }); |
| | |
| | | coverImg, |
| | | contentType: 1, |
| | | content: values.content, |
| | | sort: values.sort, |
| | | status: values.status ? 1 : 0, |
| | | isHomeRecommend: values.isHomeRecommend ? 1 : 0, |
| | | }; |
| | |
| | | </div> |
| | | </Upload> |
| | | </Form.Item> |
| | | <Form.Item label="排序" name="sort" rules={[{ required: true, message: '请输入排序' }]}> |
| | | <InputNumber min={0} precision={0} placeholder="请输入" style={{ width: '100%' }} disabled={loading} /> |
| | | </Form.Item> |
| | | <div className="health-popularization-edit-form__switch-group"> |
| | | <div className="health-popularization-edit-form__switch-item"> |
| | | <span className="health-popularization-edit-form__switch-label">是否启用</span> |