zlisen 3 vuotta sitten
vanhempi
commit
f2a34da48e

+ 11
- 11
src/pages/activity/SignupActivity/registrationRecord.jsx Näytä tiedosto

@@ -57,17 +57,17 @@ const columns = [
57 57
     key: 'orgName',
58 58
     align: 'center',
59 59
   },
60
-  {
61
-    title: '状态',
62
-    dataIndex: 'isCheckin',
63
-    key: 'isCheckin',
64
-    align: 'center',
65
-    render: (x, row) => (
66
-      <>
67
-        <span>{row.isCheckin === 1 ? '已签到' : '未签到'}</span>
68
-      </>
69
-    ),
70
-  },
60
+  // {
61
+  //   title: '状态',
62
+  //   dataIndex: 'isCheckin',
63
+  //   key: 'isCheckin',
64
+  //   align: 'center',
65
+  //   render: (x, row) => (
66
+  //     <>
67
+  //       <span>{row.isCheckin === 1 ? '已签到' : '未签到'}</span>
68
+  //     </>
69
+  //   ),
70
+  // },
71 71
 ];
72 72
 
73 73
 const header = props => {

+ 11
- 11
src/pages/activity/groupRoomActivity/registrationRecord.jsx Näytä tiedosto

@@ -57,17 +57,17 @@ const columns = [
57 57
     key: 'orgName',
58 58
     align: 'center',
59 59
   },
60
-  {
61
-    title: '状态',
62
-    dataIndex: 'isCheckin',
63
-    key: 'isCheckin',
64
-    align: 'center',
65
-    render: (x, row) => (
66
-      <>
67
-        <span>{row.isCheckin === 1 ? '已签到' : '未签到'}</span>
68
-      </>
69
-    ),
70
-  },
60
+  // {
61
+  //   title: '状态',
62
+  //   dataIndex: 'isCheckin',
63
+  //   key: 'isCheckin',
64
+  //   align: 'center',
65
+  //   render: (x, row) => (
66
+  //     <>
67
+  //       <span>{row.isCheckin === 1 ? '已签到' : '未签到'}</span>
68
+  //     </>
69
+  //   ),
70
+  // },
71 71
 ];
72 72
 
73 73
 const header = props => {

+ 11
- 11
src/pages/activity/lookHouseActivity/registrationRecord.jsx Näytä tiedosto

@@ -57,17 +57,17 @@ const columns = [
57 57
     key: 'orgName',
58 58
     align: 'center',
59 59
   },
60
-  {
61
-    title: '状态',
62
-    dataIndex: 'isCheckin',
63
-    key: 'isCheckin',
64
-    align: 'center',
65
-    render: (x, row) => (
66
-      <>
67
-        <span>{row.isCheckin === 1 ? '已签到' : '未签到'}</span>
68
-      </>
69
-    ),
70
-  },
60
+  // {
61
+  //   title: '状态',
62
+  //   dataIndex: 'isCheckin',
63
+  //   key: 'isCheckin',
64
+  //   align: 'center',
65
+  //   render: (x, row) => (
66
+  //     <>
67
+  //       <span>{row.isCheckin === 1 ? '已签到' : '未签到'}</span>
68
+  //     </>
69
+  //   ),
70
+  // },
71 71
 ];
72 72
 
73 73
 const header = props => {

+ 51
- 19
src/pages/course/Edit/index.jsx Näytä tiedosto

@@ -15,10 +15,10 @@ const goBack = () => router.goBack(-1);
15 15
 
16 16
 const CurriculumForm = React.forwardRef((props, ref) => {
17 17
   const [loading, setLoading] = useState(false);//防止多次点击 定义loadind
18
-  const [formData, setFormData] = useState();//提交表单的数据
19
-  const [contentType, setContentType] = useState(1);//单选。初始默认显示1 富文本框。点击视频, 渲染2
18
+  // const [formData, setFormData] = useState({});//提交表单的数据
19
+  const [contentType, setContentType] = useState(0);//单选。初始默认显示0 富文本框。点击视频, 渲染1
20 20
   const { form, history } = props;
21
-  const { getFieldDecorator, setFieldsValue, validateFields } = form;
21
+  const { getFieldDecorator, setFieldsValue, validateFields,getFieldValue } = form;
22 22
   const { curriculumId } = history.location.query || {}
23 23
   
24 24
   const formItemLayout = {
@@ -28,6 +28,18 @@ const CurriculumForm = React.forwardRef((props, ref) => {
28 28
 
29 29
   };
30 30
 
31
+  const fileUploadBeforeUpload = (file, fileList) => {
32
+    return new Promise((resolve, reject) => {
33
+      if (file.type === 'video/mp4' || file.type === '.mp4') {
34
+        // setVideoImage(true)
35
+        resolve(file);
36
+      } else {
37
+        notification.error({ message: '项目视频,仅支持MP4格式' });
38
+        reject();
39
+      }
40
+    });
41
+  };
42
+
31 43
   const handleSubmit = (e) => {
32 44
     e.preventDefault();
33 45
     validateFields((err, values) => {
@@ -37,7 +49,9 @@ const CurriculumForm = React.forwardRef((props, ref) => {
37 49
       }
38 50
 
39 51
       setLoading(true);//loading开始
40
-
52
+      if (values.curriculumUrl) {
53
+        values.curriculumUrl = values.curriculumUrl[0];
54
+      }
41 55
       if (curriculumId) {
42 56
         //如果有这个id拿。没有就,拿返回的curriculumId
43 57
         updateCurriculumData({
@@ -69,7 +83,12 @@ const CurriculumForm = React.forwardRef((props, ref) => {
69 83
 
70 84
   const getCourseData = useCallback(({ curriculumId }) => {//函数结果存 初始化运行一次,等待调用。
71 85
     getCurriculumData({urlData: { id: curriculumId }}).then((res) => {
72
-      setFormData(res)
86
+      if(res.curriculumUrl){
87
+        res.curriculumUrl = [res.curriculumUrl];
88
+      }
89
+      setFieldsValue(res)
90
+      // setFormData(res)
91
+      // setContentType(res.type)
73 92
     })
74 93
   }, [])
75 94
 
@@ -79,11 +98,11 @@ const CurriculumForm = React.forwardRef((props, ref) => {
79 98
     }
80 99
   }, [curriculumId])//第二次id一样不执行
81 100
 
82
-  useEffect(() => {
83
-    if (formData) {//1.form表单数据{2} 执行。无变更不执行
84
-      setFieldsValue(formData)
85
-    }
86
-  }, [formData])//2.有变更跟的话
101
+  // useEffect(() => {
102
+  //   if (formData) {//1.form表单数据{2} 执行。无变更不执行
103
+  //     setFieldsValue(formData)
104
+  //   }
105
+  // }, [formData])//2.有变更跟的话
87 106
   
88 107
 
89 108
   return (
@@ -99,8 +118,8 @@ const CurriculumForm = React.forwardRef((props, ref) => {
99 118
           })(
100 119
             <Select style={{width:'500px'}}>
101 120
               <Option value="1">经纪人</Option>
102
-              <Option value="2">业顾问</Option>
103
-              <Option value="0">职业顾问&amp;经纪人</Option>
121
+              <Option value="2">业顾问</Option>
122
+              <Option value="3">{`置业顾问&经纪人`}</Option>
104 123
             </Select>
105 124
           )
106 125
         }
@@ -142,13 +161,14 @@ const CurriculumForm = React.forwardRef((props, ref) => {
142 161
       <FormItem label="详情">
143 162
         {
144 163
           getFieldDecorator('type', {
164
+            initialValue:0,
145 165
             rules: [
146 166
               { required: true, message: '请选择详情类型' }
147 167
             ]
148 168
           })(
149
-              <Radio.Group value={contentType} onChange={e=> setContentType(e.target.value)} style={{width:'500px'}} defaultValue={1}>
150
-                <Radio value={1}>图文</Radio>
151
-                <Radio value={2}>视频</Radio>
169
+              <Radio.Group style={{width:'500px'}} >
170
+                <Radio value={0}>图文</Radio>
171
+                <Radio value={1}>视频</Radio>
152 172
               </Radio.Group>
153 173
           )
154 174
         }
@@ -169,18 +189,30 @@ const CurriculumForm = React.forwardRef((props, ref) => {
169 189
         }
170 190
 
171 191
       </FormItem> */}
172
-
173
-      <FormItem label="详情内容">
192
+     { getFieldValue('type')==0?<FormItem label="图文">
174 193
         {
175 194
           getFieldDecorator('content', {
176 195
             rules: [
177 196
               { required: true, message: '请输入详情内容' }
178 197
             ]
179 198
           })(
180
-            contentType == 1 ? <Wangedit style={{width:'500px'}}  /> : <FileUpload />
199
+           <Wangedit style={{width:'500px'}}  /> 
181 200
           )
182 201
         }
183
-      </FormItem>
202
+      </FormItem>:
203
+       <FormItem label="视频">
204
+       {
205
+         getFieldDecorator('curriculumUrl', {
206
+           rules: [
207
+             { required: true, message: '请上传视频文件' }
208
+           ]
209
+         })(
210
+          <FileUpload accept=".mp4" beforeUpload={fileUploadBeforeUpload} label="上传视频" size={1} />,
211
+         )
212
+       }
213
+     </FormItem>}
214
+
215
+     
184 216
       <FormItem label="权重" >
185 217
         {
186 218
           getFieldDecorator('weight', {

+ 49
- 47
src/pages/course/list/index.jsx Näytä tiedosto

@@ -12,7 +12,6 @@ import { router } from 'umi';
12 12
 import { getImgURL } from '@/utils/image';
13 13
 import Navigate from '@/components/Navigate';
14 14
 
15
-
16 15
 export default props => {
17 16
   const ref = useRef();
18 17
   const toEdit = useCallback(row => {
@@ -25,46 +24,45 @@ export default props => {
25 24
     });
26 25
   }, []);
27 26
 
28
-
29 27
   const confirm = data => {
30
-      // {...data,isPublish}
31
-        if (data.isPublish === 1) {
32
-          const titleCourse = data.isPublish
33
-            ? '确认取消发布此课程吗?' : '确认发布此课程吗?'
34
-          Modal.confirm({
35
-            title: titleCourse,
36
-            okText: '确认',
37
-            cancelText: '取消',
38
-            onOk() {
39
-              request({ ...apis.course.alterCourse, urlData: { id: data.curriculumId }, data: { ...data, isPublish: 0 } }).then(res => {
40
-                message.info('操作成功');
41
-                ref.current.reload();//
42
-              });
43
-            },
28
+    // {...data,isPublish}
29
+    if (data.isPublish === 1) {
30
+      const titleCourse = data.isPublish ? '确认取消发布此课程吗?' : '确认发布此课程吗?';
31
+      Modal.confirm({
32
+        title: titleCourse,
33
+        okText: '确认',
34
+        cancelText: '取消',
35
+        onOk() {
36
+          request({
37
+            ...apis.course.alterCourse,
38
+            urlData: { id: data.curriculumId },
39
+            data: { ...data, isPublish: 0 },
40
+          }).then(res => {
41
+            message.info('操作成功');
42
+            ref.current.reload(); //
44 43
           });
45
-        } else {
46
-          const titleCourse = data.isPublish
47
-            ? '确认取消发布此课程吗?' : '确认发布此课程吗?'
48
-          Modal.confirm({
49
-            title: titleCourse,
50
-            okText: '确认',
51
-            cancelText: '取消',
52
-            onOk() {
53
-              request({ ...apis.course.alterCourse, urlData: { id: data.curriculumId }, data: { ...data, isPublish: 1 } }).then(res => {
54
-                message.info('操作成功');
55
-                ref.current.reload();//
56
-              });
57
-            },
44
+        },
45
+      });
46
+    } else {
47
+      const titleCourse = data.isPublish ? '确认取消发布此课程吗?' : '确认发布此课程吗?';
48
+      Modal.confirm({
49
+        title: titleCourse,
50
+        okText: '确认',
51
+        cancelText: '取消',
52
+        onOk() {
53
+          request({
54
+            ...apis.course.alterCourse,
55
+            urlData: { id: data.curriculumId },
56
+            data: { ...data, isPublish: 1 },
57
+          }).then(res => {
58
+            message.info('操作成功');
59
+            ref.current.reload(); //
58 60
           });
59
-        }
60
-  }
61
+        },
62
+      });
63
+    }
64
+  };
61 65
 
62
-  
63
-  
64
-  
65
-  
66
-  
67
-  
68 66
   const searchFields = [
69 67
     {
70 68
       name: 'name',
@@ -79,9 +77,7 @@ export default props => {
79 77
       options: [
80 78
         { label: '经纪人', value: '1' },
81 79
         { label: '置业顾问', value: '2' },
82
-        { label: '置业顾问&经纪人', value: '0' },
83
-
84
-
80
+        { label: '置业顾问&经纪人', value: '3' },
85 81
       ],
86 82
     },
87 83
   ];
@@ -91,16 +87,21 @@ export default props => {
91 87
       dataIndex: 'name',
92 88
       key: 'name',
93 89
       align: 'center',
94
-      render: (text, row) => <Button type='link' onClick={() => toEdit(row)}>{text}</Button>
90
+      render: (text, row) => (
91
+        <Button type="link" onClick={() => toEdit(row)}>
92
+          {text}
93
+        </Button>
94
+      ),
95 95
     },
96 96
     {
97 97
       title: '课程主图',
98 98
       dataIndex: 'curriculumImg',
99 99
       key: 'curriculumImg',
100 100
       align: 'center',
101
-      render: (_, record) => <img src={getImgURL(record.curriculumImg)} style={{ width: '165px', height: '104px' }} />,
101
+      render: (_, record) => (
102
+        <img src={getImgURL(record.curriculumImg)} style={{ width: '165px', height: '104px' }} />
103
+      ),
102 104
       // render:(_,record)=>(record.curriculumImg)==''?<img src={require(record)}/>:<img src={getImgURL(record.curriculumImg)} style={{ width: '165px', height: '104px' }} />
103
-
104 105
     },
105 106
     {
106 107
       title: '阅读人数',
@@ -132,10 +133,11 @@ export default props => {
132 133
       align: 'center',
133 134
       render: withActions(
134 135
         (_, row) => [
135
-            <OperButton onClick={()=>confirm(row)}> {row.isPublish === 0 ? '发布' : '取消发布'}</OperButton>,
136
+          <OperButton onClick={() => confirm(row)}>
137
+            {row.isPublish === 0 ? '发布' : '取消发布'}
138
+          </OperButton>,
136 139
           <AuthButton name="admin.building.delete" noRight={null}>
137
-            <OperButton>添加标签</OperButton>
138
-            <OperButton onClick={() => toEdit(row)}>{row.isPublish === 1 ? '编辑' : ''}</OperButton>
140
+            <OperButton onClick={() => toEdit(row)}>编辑</OperButton>
139 141
           </AuthButton>,
140 142
         ],
141 143
         { noMargin: true },
@@ -156,7 +158,7 @@ export default props => {
156 158
     <>
157 159
       <QueryTable
158 160
         ref={ref}
159
-        rowKey='curriculumId'
161
+        rowKey="curriculumId"
160 162
         api={apis.course.Tablecourse}
161 163
         columns={tableColumns}
162 164
         searchFields={searchFields}