Commit f802bc34 by wufan

feat:更换裁剪dom

parent 3156f35f
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: wufan * @Author: wufan
* @Date: 2020-11-25 18:25:02 * @Date: 2020-11-25 18:25:02
* @LastEditors: wufan * @LastEditors: wufan
* @LastEditTime: 2020-12-21 14:24:15 * @LastEditTime: 2020-12-21 18:11:07
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -29,6 +29,9 @@ export function deleteStoreDecorationList(params: object) { ...@@ -29,6 +29,9 @@ export function deleteStoreDecorationList(params: object) {
export function addStoreBanner(params: object) { export function addStoreBanner(params: object) {
return Service.Hades("public/hades/addStoreBanner", params); return Service.Hades("public/hades/addStoreBanner", params);
} }
export function editStoreBanner(params: object) {
return Service.Hades("public/hades/editStoreBanner", params);
}
export function addEmployee(params: object) { export function addEmployee(params: object) {
return Service.Hades("public/hades/addStoreUser", params); return Service.Hades("public/hades/addStoreUser", params);
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
* @Author: wufan * @Author: wufan
* @Date: 2020-11-25 18:25:02 * @Date: 2020-11-25 18:25:02
* @LastEditors: wufan * @LastEditors: wufan
* @LastEditTime: 2020-12-21 14:24:23 * @LastEditTime: 2020-12-21 18:10:52
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import { getEmployeeList, getUserList, getStoreDecorationList, getStoreRole, addEmployee, editEmployee, deleteEmployee, getCourseCatalogList, getAllSonCategory, addCourseCategory, delCourseCategory, editCourseCategory, deleteStoreDecorationList, addStoreBanner } from '@/data-source/store/request-apis'; import { getEmployeeList, getUserList, getStoreDecorationList, getStoreRole, addEmployee, editEmployee, deleteEmployee, getCourseCatalogList, getAllSonCategory, addCourseCategory, delCourseCategory, editCourseCategory, deleteStoreDecorationList, addStoreBanner, editStoreBanner } from '@/data-source/store/request-apis';
export default class StoreService { export default class StoreService {
// 获取员工列表 // 获取员工列表
...@@ -49,10 +49,14 @@ export default class StoreService { ...@@ -49,10 +49,14 @@ export default class StoreService {
return deleteStoreDecorationList(params); return deleteStoreDecorationList(params);
} }
// 删除店铺banner列表 // 添加店铺banner列表
static addStoreBanner(params: any) { static addStoreBanner(params: any) {
return addStoreBanner(params); return addStoreBanner(params);
} }
// 替换店铺banner列表
static editStoreBanner(params: any) {
return editStoreBanner(params);
}
// 获取课程分类列表 // 获取课程分类列表
static getCourseCatalogList(params: any) { static getCourseCatalogList(params: any) {
......
...@@ -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-21 17:32:22 * @LastEditTime: 2020-12-21 19:42:53
* @Description: web店铺banner页面 * @Description: web店铺banner页面
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -123,7 +123,7 @@ class StoreWebDecoration extends React.Component { ...@@ -123,7 +123,7 @@ class StoreWebDecoration extends React.Component {
<div className="operation"> <div className="operation">
<span <span
className="edit" className="edit"
onClick={() => handleReplaceDecoration(record)} onClick={() => this.handleReplaceDecoration(record)}
> >
替换 替换
</span> </span>
...@@ -147,7 +147,12 @@ class StoreWebDecoration extends React.Component { ...@@ -147,7 +147,12 @@ class StoreWebDecoration extends React.Component {
}); });
}; };
handleReplaceDecoration = (record) => {}; handleReplaceDecoration = (record) => {
this.setState({
showSelectFileModal: true,
choosedBannerId: record.id
});
};
handleDeleteDecoration = (record) => { handleDeleteDecoration = (record) => {
StoreService.deleteStoreDecorationList({ StoreService.deleteStoreDecorationList({
...@@ -224,7 +229,7 @@ class StoreWebDecoration extends React.Component { ...@@ -224,7 +229,7 @@ class StoreWebDecoration extends React.Component {
}, },
() => { () => {
setTimeout(() => { setTimeout(() => {
const okBtnDom = document.querySelector("#clipBtn"); const okBtnDom = document.querySelector("#headPicModal");
const viewImgDom = document.querySelector('#preview-url-box'); const viewImgDom = document.querySelector('#preview-url-box');
const options = { const options = {
...@@ -258,10 +263,8 @@ class StoreWebDecoration extends React.Component { ...@@ -258,10 +263,8 @@ class StoreWebDecoration extends React.Component {
}; };
if (!this.state.photoclip) { if (!this.state.photoclip) {
const photoclip = new PhotoClip("#headPicModal", options); const photoclip = new PhotoClip("#headPicModal", options);
console.log("photoclip-111",photoclip);
photoclip.load(imageFile.ossUrl); photoclip.load(imageFile.ossUrl);
console.log("photoclip-222",photoclip); console.log("photoclip-222",photoclip);
console.log("imageFile.ossUrl",imageFile.ossUrl);
this.setState({ this.setState({
photoclip, photoclip,
}); });
...@@ -276,18 +279,28 @@ class StoreWebDecoration extends React.Component { ...@@ -276,18 +279,28 @@ class StoreWebDecoration extends React.Component {
//获取resourceId //获取resourceId
getSignature = (blob, fileName) => { getSignature = (blob, fileName) => {
const { choosedBannerId } = this.state;
Upload.uploadBlobToOSS(blob, 'avatar' + (new Date()).valueOf()).then((addBannerPath) => { Upload.uploadBlobToOSS(blob, 'avatar' + (new Date()).valueOf()).then((addBannerPath) => {
this.setState({ this.setState({
visible: false,
addBannerPath addBannerPath
},()=>{
this.addStoreBanner();
this.getStoreDecorationList();
}) })
}); });
}; };
editStoreBanner = () => {
const { previewUrl, addBannerPath, choosedBannerId} = this.state;
const params = {
bannerPath: addBannerPath,
storeBannerId: choosedBannerId,
termType: "WEB_ADMIN",
};
StoreService.editStoreBanner(params).then((res) => {
message.success("替换成功");
this.getStoreDecorationList();
// this.state.photoclip.destroy();
});
};
addStoreBanner = () => { addStoreBanner = () => {
const { previewUrl, addBannerPath} = this.state; const { previewUrl, addBannerPath} = this.state;
const params = { const params = {
...@@ -297,6 +310,7 @@ class StoreWebDecoration extends React.Component { ...@@ -297,6 +310,7 @@ class StoreWebDecoration extends React.Component {
}; };
StoreService.addStoreBanner(params).then((res) => { StoreService.addStoreBanner(params).then((res) => {
message.success("添加成功"); message.success("添加成功");
this.getStoreDecorationList();
}); });
}; };
...@@ -399,6 +413,8 @@ class StoreWebDecoration extends React.Component { ...@@ -399,6 +413,8 @@ class StoreWebDecoration extends React.Component {
cutFlag = true; cutFlag = true;
this.refs.hiddenBtn.click(); this.refs.hiddenBtn.click();
} }
this.setState({ visible: false });
this.state.choosedBannerId ? this.editStoreBanner(): this.addStoreBanner();
}} }}
> >
确定 确定
...@@ -417,7 +433,7 @@ class StoreWebDecoration extends React.Component { ...@@ -417,7 +433,7 @@ class StoreWebDecoration extends React.Component {
<div id="clipBtn" style={{ display: "none" }} ref="hiddenBtn"></div> <div id="clipBtn" style={{ display: "none" }} ref="hiddenBtn"></div>
<div className="preview-img"> <div className="preview-img">
<div className="title">效果预览</div> <div className="title">效果预览</div>
<img src={previewUrl} alt="图片预览" className="preview-url" /> {/* <img src={previewUrl} alt="图片预览" className="preview-url" /> */}
<div id="preview-url-box"></div> <div id="preview-url-box"></div>
</div> </div>
</div> </div>
......
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