yu_ber 4 年 前
コミット
df5541e398
共有1 個のファイルを変更した15 個の追加9 個の削除を含む
  1. 15 9
      UI/src/pages/ArticleContentManage/index.js

+ 15 - 9
UI/src/pages/ArticleContentManage/index.js

@@ -178,6 +178,7 @@ class ArticleManage extends React.Component {
         let list = []
         let obj = {}
         obj.url = imgUrlMini
+        obj.status = "done",
         obj.uid = '-2'
         list.push(obj)
         this.setState({
@@ -734,6 +735,19 @@ class ArticleManage extends React.Component {
         <Icon type='plus' />
       </div>
     );
+    let SsoToken = util.auth.getToken();
+    let fileProps = {
+      action: WXMpAPI + "/wx/content/upload/",
+      listType: 'picture-card',
+      fileList: this.state.headImgList,
+      showUploadList: true,
+      onChange: result => this.handleChange(result),
+      onPreview:result => this.onPreview(result),
+      onRemove:result => this.removeImg(result),
+      headers:{
+        'Sso-Token': SsoToken
+      },
+    };
     return (
       <div className="ArticleManage">
         {/* <Modal
@@ -866,15 +880,7 @@ class ArticleManage extends React.Component {
               </Form.Item>
 
               <Form.Item label="封面图片">
-                <Upload
-                  listType="picture-card"
-                  fileList={this.state.headImgList}
-                  showUploadList={{ showPreviewIcon: true }}
-                  onPreview={file => this.onPreview(file)}// 预览
-                  onRemove={file => this.removeImg("headImgList")}
-                  onChange={result => this.handleChange(result, "headImgList")}
-                  action={WXMpAPI + "/wx/content/upload "}
-                >
+                <Upload {...fileProps}>
                   {this.state.headImgList.length >= 1 ? null : uploadButton}
                 </Upload>
               </Form.Item>