Browse Source

修复图片bug

yu_ber 4 years ago
parent
commit
a4e3edcb8e
1 changed files with 39 additions and 54 deletions
  1. 39 54
      UI/src/pages/contentManage/columnManage.js

+ 39 - 54
UI/src/pages/contentManage/columnManage.js

@@ -132,7 +132,6 @@ class BirdGridPermissionPage extends React.Component {
             data: list
         }).then(function (getListRes) {
             if (getListRes.success == 1) {
-                console.log(getListRes);
                 self.setState({
                     floordata: getListRes.items
                 })
@@ -141,21 +140,6 @@ class BirdGridPermissionPage extends React.Component {
         });
     }
 
-        // // 获取所有楼层图片信息
-            // const imgList = this.state.floordata
-            // console.log(imgList, 'imgList');
-            // const obj = {}
-            // obj.floorId = imgList[0].floorId
-            // obj.floorName = imgList[0].floorName
-            // const list = imgList[0].floorItemList
-            // obj.floorItemList = list
-    
-            // this.setState({
-            //     addsavefloordata: obj,
-            //     columnId: imgList[0].floorColumnId
-            // }, () => {
-                
-            // })
 
     //请求轮播数据
     requestmenudata = () => {
@@ -176,14 +160,6 @@ class BirdGridPermissionPage extends React.Component {
             data: list
         }).then(function (getListRes) {
             if (getListRes.success == 1) {
-                // self.state.headImgList = getListRes.items.map((item,index)=>{
-                //     return {
-                //         uid: '-'+index,
-                //         name: 'image.png',
-                //         status: 'done',
-                //         url: 'http://'+item.rotationGraphAddress,
-                //       }
-                // })
 
                 self.setState({
                     Menudata: getListRes.items,
@@ -316,13 +292,14 @@ class BirdGridPermissionPage extends React.Component {
         this.state.show[index].display = true
         // 获取所有楼层图片信息
         const imgList = this.state.floordata
-        console.log(imgList, 'imgList');
+        // console.log(imgList, 'imgList');
         const obj = {}
         obj.floorId = imgList[index].floorId
         obj.floorName = imgList[index].floorName
-        const list = imgList[index].floorItemList
+        // console.log(imgList,'imgList');
+        // console.log(imgList[index].floorItemList,'imgList[index].flvaroorItemList');
+        const list = imgList[index].floorItemList ? imgList[index].floorItemList : []
         obj.floorItemList = list
-
         let img1 = [{
             uid: "-1",
             key: 0,
@@ -344,7 +321,7 @@ class BirdGridPermissionPage extends React.Component {
             src: imgList[index].floorItemList[3].flooritemPhotoaddress
         }]
 
-
+        console.log(obj)
         this.setState({
             show: this.state.show,
             addshow: this.state.addshow,
@@ -355,7 +332,6 @@ class BirdGridPermissionPage extends React.Component {
             fileListChildren_imgs_item: img4,
             columnId: imgList[index].floorColumnId
         }, () => {
-            console.log(this.state.fileListChildren_imgs_item);
         })
 
     }
@@ -856,11 +832,10 @@ class BirdGridPermissionPage extends React.Component {
 
     }
     handleFile = (handle, index) => {
-        console.log(handle, 'fileListChildren')
+        let SsoToken = util.auth.getToken();
         let element = [{
             key: index,
-            // src: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
-            src: handle.fileList[0] && handle.fileList[0].response ? handle.fileList[0].response.path : "",
+            src: handle.fileList[0] && handle.fileList[0].response ? handle.fileList[0].response.path+"?Sso-Token="+SsoToken : "",
         }]
         if (index == 0) {
             this.setState({
@@ -885,12 +860,11 @@ class BirdGridPermissionPage extends React.Component {
 
     }
     handleChange = (handle) => {
-        console.log(handle, 'handle')
         this.setState({
             headImgList: handle.fileList,
             handImgBanner: handle.fileList[0] && handle.fileList[0].response ? handle.fileList[0].response.path : "",
         }, () => {
-            console.log(this.state.headImgList);
+
         })
     }
     editColumnMS = (e) => {
@@ -981,12 +955,20 @@ class BirdGridPermissionPage extends React.Component {
     }
     departments_list = (event) => {
         let that = this
+        // let { columnId } = self.state
         let gridOption = {
             title: "权限资源",
             title: "关键词",
             url: {
                 read: WXMpAPI + '/wx/content/department/queryAllSecondDepartments',
             },
+            // customRules: [
+            //     {
+            //         field: "column_id",
+            //         operate: "equal",
+            //         value:columnId,
+            //     }
+            // ],
 
             pageSize: 10,
             checkable: true,
@@ -1028,29 +1010,18 @@ class BirdGridPermissionPage extends React.Component {
         };
         return gridOption
     }
+
+    departments_columnId = ()=>{
+        
+    }
     render() {
-        // 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
-        // },
-        // };
         let self = this
+        const { columnId } = self.state
         //推荐科室
         let departments = {
             title: "表格示例",
             url: {
                 read: WXMpAPI + "/wx/content/department/queryDepartmentsByColumnId/",
-                // add: "/test/add",
-                // edit: "/test/edit",
-                // delete: "/test/delete"
             },
             filters: [
                 {
@@ -1059,6 +1030,13 @@ class BirdGridPermissionPage extends React.Component {
                     "value": self.state.columnId
                 }
             ],
+            customRules: [
+                {
+                    field: "column_id",
+                    operate: "equal",
+                    value:columnId,
+                }
+            ],
             checkable: false,
             // dataSource: [
             //     { id: 1, title: "xiaohong" },
@@ -1075,7 +1053,7 @@ class BirdGridPermissionPage extends React.Component {
             columns: [
                 { title: "科室ID", data: "departmentId", type: "number" },
                 { title: "科室名称", data: "departmentName", type: "text", editor: {} },
-                { title: "科室图标", data: "title", type: "text", editor: {} },
+                { title: "科室图标", data: "departmentIconaddress", type: "text", editor: {} },
                 {
                     title: "操作", type: "command", actions: [{
                         name: '移出',
@@ -1116,6 +1094,9 @@ class BirdGridPermissionPage extends React.Component {
                 }
             ]
         };
+
+        // console.log(columnId,departments,'columnId');
+
         let departments_alert = {
             title: "表格示例",
             url: {
@@ -1265,10 +1246,10 @@ class BirdGridPermissionPage extends React.Component {
                 'Sso-Token': SsoToken
             },
         };
+        // fileList: this.state.headImgList,
         let fileProps = {
             action: WXMpAPI + "/wx/content/upload/",
             listType: 'picture-card',
-            fileList: this.state.headImgList,
             showUploadList: true,
             onPreview: result => this.onPreview(result),
             onRemove: result => this.removeImg(result),
@@ -1320,7 +1301,7 @@ class BirdGridPermissionPage extends React.Component {
                                 <div className="search_name"><span>楼层名称</span><Input placeholder="最多输入8个字" value={this.state.addsavefloordata.floorName} onChange={(e) => this.addfloorname(e)}></Input></div>
                                 <div className="shop_manage">
                                     {
-                                        self.state.addsavefloordata.floorItemList.map((item, index) => {
+                                       self.state.addsavefloordata.floorItemList && self.state.addsavefloordata.floorItemList.map((item, index) => {
                                             return (
                                                 <div className="shop_item">
                                                     <h2>图片{item.flooritemIndex}</h2>
@@ -1385,7 +1366,11 @@ class BirdGridPermissionPage extends React.Component {
                                         <div className="slide_cont">
                                             <div className="text">封面</div>
 
-                                            <Upload {...fileProps} onChange={result => this.handleChange(result)} >
+                                            {/* <Upload {...fileProps} onChange={result => this.handleChange(result)} >
+                                                {this.state.headImgList.length >= 1 ? null : uploadButton}
+                                            </Upload> */}
+
+                                        <Upload {...fileProps} onChange={result => this.handleChange(result)} >
                                                 {this.state.headImgList.length >= 1 ? null : uploadButton}
                                             </Upload>
                                         </div>