Commit 75061134 by wufan

fix:优化传文件到oss

parent 9349a9c6
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: wufan * @Author: wufan
* @Date: 2020-11-30 10:47:38 * @Date: 2020-11-30 10:47:38
* @LastEditors: wufan * @LastEditors: wufan
* @LastEditTime: 2020-12-24 13:37:32 * @LastEditTime: 2020-12-24 18:33:10
* @Description: web店铺banner页面 * @Description: web店铺banner页面
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -49,6 +49,7 @@ class StoreWebDecoration extends React.Component { ...@@ -49,6 +49,7 @@ class StoreWebDecoration extends React.Component {
diskList: [], diskList: [],
photoclip: null, photoclip: null,
preview: "", preview: "",
cutImageBlob: null
}; };
} }
...@@ -229,8 +230,10 @@ class StoreWebDecoration extends React.Component { ...@@ -229,8 +230,10 @@ class StoreWebDecoration extends React.Component {
jpgFillColor: "transparent", jpgFillColor: "transparent",
}, },
done: (dataUrl) => { done: (dataUrl) => {
const cutImage = this.convertBase64UrlToBlob(dataUrl); const cutImageBlob = this.convertBase64UrlToBlob(dataUrl);
this.getSignature(cutImage, fileName); this.setState({
cutImageBlob
})
setTimeout(() => { setTimeout(() => {
cutFlag = false; cutFlag = false;
}, 2000); }, 2000);
...@@ -272,6 +275,11 @@ class StoreWebDecoration extends React.Component { ...@@ -272,6 +275,11 @@ class StoreWebDecoration extends React.Component {
(addBannerPath) => { (addBannerPath) => {
this.setState({ this.setState({
addBannerPath, addBannerPath,
visible: false
},()=>{
this.state.choosedBannerId
? this.editStoreBanner()
: this.addStoreBanner();
}); });
} }
); );
...@@ -332,6 +340,7 @@ class StoreWebDecoration extends React.Component { ...@@ -332,6 +340,7 @@ class StoreWebDecoration extends React.Component {
showSelectFileModal, showSelectFileModal,
diskList, diskList,
visible, visible,
cutImageBlob
} = this.state; } = this.state;
const DraggableContainer = (props) => ( const DraggableContainer = (props) => (
<SortableContainer <SortableContainer
...@@ -414,10 +423,7 @@ class StoreWebDecoration extends React.Component { ...@@ -414,10 +423,7 @@ class StoreWebDecoration extends React.Component {
cutFlag = true; cutFlag = true;
this.refs.hiddenBtn.click(); this.refs.hiddenBtn.click();
} }
this.setState({ visible: false }); this.getSignature(cutImageBlob);
this.state.choosedBannerId
? this.editStoreBanner()
: this.addStoreBanner();
}} }}
> >
确定 确定
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: wufan * @Author: wufan
* @Date: 2020-11-30 10:47:38 * @Date: 2020-11-30 10:47:38
* @LastEditors: wufan * @LastEditors: wufan
* @LastEditTime: 2020-12-24 13:38:10 * @LastEditTime: 2020-12-24 18:30:46
* @Description: web店铺banner页面 * @Description: web店铺banner页面
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -49,6 +49,7 @@ class StoreWebDecoration extends React.Component { ...@@ -49,6 +49,7 @@ class StoreWebDecoration extends React.Component {
diskList: [], diskList: [],
photoclip: null, photoclip: null,
preview: "", preview: "",
cutImageBlob: null
}; };
} }
...@@ -228,8 +229,10 @@ class StoreWebDecoration extends React.Component { ...@@ -228,8 +229,10 @@ class StoreWebDecoration extends React.Component {
jpgFillColor: "transparent", jpgFillColor: "transparent",
}, },
done: (dataUrl) => { done: (dataUrl) => {
const cutImage = this.convertBase64UrlToBlob(dataUrl); const cutImageBlob = this.convertBase64UrlToBlob(dataUrl);
this.getSignature(cutImage, fileName); this.setState({
cutImageBlob
})
setTimeout(() => { setTimeout(() => {
cutFlag = false; cutFlag = false;
}, 2000); }, 2000);
...@@ -268,6 +271,11 @@ class StoreWebDecoration extends React.Component { ...@@ -268,6 +271,11 @@ class StoreWebDecoration extends React.Component {
(addBannerPath) => { (addBannerPath) => {
this.setState({ this.setState({
addBannerPath, addBannerPath,
visible: false
},()=>{
this.state.choosedBannerId
? this.editStoreBanner()
: this.addStoreBanner();
}); });
} }
); );
...@@ -330,6 +338,7 @@ class StoreWebDecoration extends React.Component { ...@@ -330,6 +338,7 @@ class StoreWebDecoration extends React.Component {
showSelectFileModal, showSelectFileModal,
diskList, diskList,
visible, visible,
cutImageBlob
} = this.state; } = this.state;
const DraggableContainer = (props) => ( const DraggableContainer = (props) => (
<SortableContainer <SortableContainer
...@@ -412,10 +421,7 @@ class StoreWebDecoration extends React.Component { ...@@ -412,10 +421,7 @@ class StoreWebDecoration extends React.Component {
cutFlag = true; cutFlag = true;
this.refs.hiddenBtn.click(); this.refs.hiddenBtn.click();
} }
this.setState({ visible: false }); this.getSignature(cutImageBlob);
this.state.choosedBannerId
? this.editStoreBanner()
: this.addStoreBanner();
}} }}
> >
确定 确定
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment