yee 7 年 前
コミット
55acc2701a
共有1 個のファイルを変更した38 個の追加0 個の削除を含む
  1. 38 0
      js/component/manageCenter/idea/news/news.jsx

+ 38 - 0
js/component/manageCenter/idea/news/news.jsx

@@ -8,8 +8,16 @@ import ajax from 'jquery/src/ajax/xhr.js';
 import $ from 'jquery/src/ajax';
 
 function uploadImg(s) {
+<<<<<<< HEAD
     let myform = new FormData();
     myform.append('file', document.getElementById("fileToUpload").files[0]);
+=======
+    let myform = new FormData(), file = document.getElementById("fileToUpload").files[0];
+    if (!file) {
+        return;
+    }
+    myform.append('file', file);
+>>>>>>> 6216a1d29e2cfc72eae6df5c9bb1dad2b513a700
     myform.append('sign', 'news_content_picture');
     $.ajax({
         method: "post",
@@ -22,19 +30,33 @@ function uploadImg(s) {
             if (data.error && data.error.length) {
                 message.warning(data.error[0].message);
             } else {
+<<<<<<< HEAD
                 let theUrl = data.data;
                 const cursorPosition = s.quill.getSelection().index
                 s.quill.insertEmbed(cursorPosition, 'image', globalConfig.avatarHost + '/upload' + theUrl)
+=======
+                const cursorPosition = s.quill.getSelection().index
+                s.quill.insertEmbed(cursorPosition, 'image', globalConfig.avatarHost + '/upload' + data.data)
+>>>>>>> 6216a1d29e2cfc72eae6df5c9bb1dad2b513a700
                 s.quill.setSelection(cursorPosition + 1)
             };
         }
     })
 }
 function fileSelect() {
+<<<<<<< HEAD
     let uploader = document.getElementById("fileToUpload"), _me = this;
     uploader.onchange = () => {
         uploadImg(_me);
     };
+=======
+    let uploader = document.getElementById("fileToUpload");
+    if (!uploader.onchange) {
+        uploader.onchange = () => {
+            uploadImg(this)
+        }
+    }
+>>>>>>> 6216a1d29e2cfc72eae6df5c9bb1dad2b513a700
     uploader.click();
 }
 const Avatar = React.createClass({
@@ -511,6 +533,7 @@ const News = React.createClass({
                                         <Radio value={1}>是</Radio>
                                     </Radio.Group>
                                 </div>
+<<<<<<< HEAD
                             </div>
                         </div>
                         <div className="modal-box">
@@ -525,6 +548,21 @@ const News = React.createClass({
                             name="fileToUpload"
                             id="fileToUpload"
                             style={{ "display": "none" }} />
+=======
+                            </Tabs.TabPane>
+                            <Tabs.TabPane tab="详情" key="2">
+                                <ReactQuill theme="snow"
+                                    value={this.state.RowData.content}
+                                    modules={modules}
+                                    formats={formats}
+                                    onChange={this.handleRichText} />
+                                <input type="file"
+                                    name="fileToUpload"
+                                    id="fileToUpload"
+                                    style={{ "display": "none" }} />
+                            </Tabs.TabPane>
+                        </Tabs>
+>>>>>>> 6216a1d29e2cfc72eae6df5c9bb1dad2b513a700
                         <div className="modal-box">
                             <Button type="primary" onClick={this.submit}>提交</Button>
                             <Button type="ghost" onClick={() => { this.setState({ visible: false }) }}>取消</Button>