Commit 57f64f2f by guomingpang

Merge branch 'dev' of…

Merge branch 'dev' of ssh://xmgit.ixm5.cn:10022/xiaomai-cloud-class/xiaomai-cloud-class-web into dev
parents 5d32c483 5bc81318
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
"react": "^16.13.1", "react": "^16.13.1",
"react-app-polyfill": "^1.0.6", "react-app-polyfill": "^1.0.6",
"react-async-component": "^2.0.0", "react-async-component": "^2.0.0",
"react-cropper": "^2.1.8",
"react-dev-utils": "^10.2.1", "react-dev-utils": "^10.2.1",
"react-dom": "^16.13.1", "react-dom": "^16.13.1",
"react-infinite-scroller": "^1.2.4", "react-infinite-scroller": "^1.2.4",
......
import React from 'react';
import { Modal, Button } from 'antd';
import Cropper from 'react-cropper';
import 'cropperjs/dist/cropper.css';
import './ImgClipModal.less';
import { isNull } from 'underscore';
class ImgClipModal extends React.Component {
constructor(props) {
super(props);
this.state = {
hasImgReady: false, // 图片是否上传成功
cropperInstace:null,
}
}
render() {
const {
imgUrl,
title = "设置图片",
modalWidth=1080,
visible,
clipContentWidth='500px',
clipContentHeight='430px',
aspectRatio=16/9,
cropBoxWidth=500,
cropBoxHeight=282,
previewBoxWidth='500px',
previewBoxHeight='282px',
onConfirm,
onClose,
} = this.props;
const { hasImgReady,cropperInstace} = this.state;
return (
<Modal
className="img-clip-modal"
title={title}
width={modalWidth}
visible={visible}
maskClosable={false}
closeIcon={<span className="icon iconfont modal-close-icon">&#xe6ef;</span>}
onCancel={() => {
onClose();
}}
zIndex={10001}
footer={[
<Button
key="back"
onClick={() => {
onClose();
}}
>
重新上传
</Button>,
<Button
key="submit"
type="primary"
disabled={!hasImgReady}
onClick={() => {
const cutImg = this.state.cropperInstace.getCroppedCanvas().toDataURL();
const cutImageBlob = window.convertBase64ToBlob(cutImg);
onConfirm(cutImageBlob);
}}
>
确定
</Button>,
]}
>
<div className="clip-box">
<div
style={{
width:clipContentWidth,
height:clipContentHeight,
marginBottom: 0,
}}
>
<Cropper
style={{ height:clipContentHeight, width:clipContentWidth}}
className="cropper__box"
zoomTo={2}
aspectRatio={aspectRatio}
preview=".preview-url-box"
src={imgUrl}
viewMode={1}
guides={true}
background={false}
responsive={true}
autoCropArea={1}
checkOrientation={false}
cropBoxResizable={false}
center={true}
// minCropBoxWidth={cropBoxWidth}
// minCropBoxHeight={cropBoxHeight}
cropBoxMovable={false}
dragMode='move'
onInitialized={(instance) => {
this.setState({
cropperInstace:instance
})
}}
ready={()=>{
this.setState({
hasImgReady:true
})
this.state.cropperInstace.setCropBoxData({width:Number(cropBoxWidth),height:Number(cropBoxHeight),top:(215 - cropBoxHeight/2)});
console.log("height++++",this.state.cropperInstace.getImageData().height);
console.log("width++++",this.state.cropperInstace.getImageData().width);
const ratio = (this.state.cropperInstace.getImageData().width/2)/500;
console.log("ratio++++",ratio);
this.state.cropperInstace.setCanvasData({width:500});
const that = this;
// const containerData = this.state.cropperInstace.getContainerData();
// // Zoom to 50% from the center of the container.
// this.state.cropperInstace.zoomTo(.5, {
// x: containerData.width / 2,
// y: containerData.height / 2,
// });
document.querySelector('.cropper__box').addEventListener('dblclick', function (e) {
that.state.cropperInstace.rotate(90)
});
}}
/>
</div>
<div id="clipBtn" style={{ display: "none" }} ref="hiddenBtn"></div>
<div className="preview-img">
<div className="title">效果预览</div>
<div id="preview-url-box" style={{width:previewBoxWidth,height:previewBoxHeight}} className="preview-url-box">
</div>
<div className="tip-box">
<div className="tip">温馨提示</div>
<div className="tip">①预览效果图时可能存在延迟,单击左侧图片刷新即可</div>
<div className="tip">②设置图片时双击可旋转图片,滚动可放大或缩小图片</div>
</div>
</div>
</div>
</Modal>
)
}
}
export default ImgClipModal;
\ No newline at end of file
.img-clip-modal{
.preview-url-box{
overflow: hidden;
}
}
/*
* @Author: your name
* @Date: 2021-07-02 17:15:50
* @LastEditTime: 2021-07-02 17:23:47
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /xiaomai-cloud-class-web/src/core/downLoad.js
*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root.download = factory();
}
})(this, function () {
return function download(data, strFileName, strMimeType) {
var self = window, // this script is only for browsers anyway...
defaultMime = 'application/octet-stream', // this default mime also triggers iframe downloads
mimeType = strMimeType || defaultMime,
payload = data,
url = !strFileName && !strMimeType && payload,
anchor = document.createElement('a'),
toString = function (a) {
return String(a);
},
myBlob = self.Blob || self.MozBlob || self.WebKitBlob || toString,
fileName = strFileName || 'download',
blob,
reader;
myBlob = myBlob.call ? myBlob.bind(self) : Blob;
if (String(this) === 'true') {
//reverse arguments, allowing download.bind(true, "text/xml", "export.xml") to act as a callback
payload = [payload, mimeType];
mimeType = payload[0];
payload = payload[1];
}
if (url && url.length < 2048) {
// if no filename and no mime, assume a url was passed as the only argument
fileName = url.split('/').pop().split('?')[0];
anchor.href = url; // assign href prop to temp anchor
if (anchor.href.indexOf(url) !== -1) {
// if the browser determines that it's a potentially valid url path:
var ajax = new XMLHttpRequest();
ajax.open('GET', url, true);
ajax.responseType = 'blob';
ajax.onload = function (e) {
download(e.target.response, fileName, defaultMime);
};
setTimeout(function () {
ajax.send();
}, 0); // allows setting custom ajax headers using the return:
return ajax;
} // end if valid url?
} // end if url?
//go ahead and download dataURLs right away
if (/^data\:[\w+\-]+\/[\w+\-]+[,;]/.test(payload)) {
if (payload.length > 1024 * 1024 * 1.999 && myBlob !== toString) {
payload = dataUrlToBlob(payload);
mimeType = payload.type || defaultMime;
} else {
return navigator.msSaveBlob // IE10 can't do a[download], only Blobs:
? navigator.msSaveBlob(dataUrlToBlob(payload), fileName)
: saver(payload); // everyone else can save dataURLs un-processed
}
} //end if dataURL passed?
blob = payload instanceof myBlob ? payload : new myBlob([payload], { type: mimeType });
function dataUrlToBlob(strUrl) {
var parts = strUrl.split(/[:;,]/),
type = parts[1],
decoder = parts[2] == 'base64' ? atob : decodeURIComponent,
binData = decoder(parts.pop()),
mx = binData.length,
i = 0,
uiArr = new Uint8Array(mx);
for (i; i < mx; ++i) uiArr[i] = binData.charCodeAt(i);
return new myBlob([uiArr], { type: type });
}
function saver(url, winMode) {
if ('download' in anchor) {
//html5 A[download]
anchor.href = url;
anchor.setAttribute('download', fileName);
anchor.className = 'download-js-link';
anchor.innerHTML = 'downloading...';
anchor.style.display = 'none';
document.body.appendChild(anchor);
setTimeout(function () {
anchor.click();
document.body.removeChild(anchor);
if (winMode === true) {
setTimeout(function () {
self.URL.revokeObjectURL(anchor.href);
}, 250);
}
}, 66);
return true;
}
// handle non-a[download] safari as best we can:
if (/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) {
url = url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
if (!window.open(url)) {
// popup blocked, offer direct download:
if (confirm('Displaying New Document\n\nUse Save As... to download, then click back to return to this page.')) {
location.href = url;
}
}
return true;
}
//do iframe dataURL download (old ch+FF):
var f = document.createElement('iframe');
document.body.appendChild(f);
if (!winMode) {
// force a mime that will download:
url = 'data:' + url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
}
f.src = url;
setTimeout(function () {
document.body.removeChild(f);
}, 333);
} //end saver
if (navigator.msSaveBlob) {
// IE10+ : (has Blob, but not a[download] or URL)
return navigator.msSaveBlob(blob, fileName);
}
if (self.URL) {
// simple fast and modern way using Blob and URL:
saver(self.URL.createObjectURL(blob), true);
} else {
// handle non-Blob()+non-URL browsers:
if (typeof blob === 'string' || blob.constructor === toString) {
try {
return saver('data:' + mimeType + ';base64,' + self.btoa(blob));
} catch (y) {
return saver('data:' + mimeType + ',' + encodeURIComponent(blob));
}
}
// Blob but not URL support:
reader = new FileReader();
reader.onload = function (e) {
saver(this.result);
};
reader.readAsDataURL(blob);
}
return true;
}; /* end download() */
});
\ No newline at end of file
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
min-height: 100%; min-height: 100%;
overflow: hidden;
.page { .page {
position: fixed; position: fixed;
top: 60px; top: 60px;
...@@ -21,6 +22,7 @@ ...@@ -21,6 +22,7 @@
z-index: 102; z-index: 102;
overflow: auto; overflow: auto;
margin: 0 16px; margin: 0 16px;
.box { .box {
&:first-child { &:first-child {
margin-bottom: 8px; margin-bottom: 8px;
......
<!-- <!--
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-08-24 12:20:57 * @Date: 2020-08-24 12:20:57
* @LastEditors: fusanqiasng * @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-21 15:12:28 * @LastEditTime: 2021-07-04 09:55:24
* @Description: * @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
--> -->
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-04-27 20:35:34 * @Date: 2020-04-27 20:35:34
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-28 16:17:53 * @LastEditTime: 2021-07-04 09:55:15
* @Description: * @Description:
*/ */
...@@ -18,6 +18,7 @@ import 'antd/dist/antd.less'; ...@@ -18,6 +18,7 @@ import 'antd/dist/antd.less';
import 'video-react/dist/video-react.css'; import 'video-react/dist/video-react.css';
import '@/common/less/index.less'; import '@/common/less/index.less';
import '@/core/function'; import '@/core/function';
// import '@/core/downloads';
import '@/core/xmTD'; import '@/core/xmTD';
import User from '@/common/js/user'; import User from '@/common/js/user';
import Service from "@/common/js/service"; import Service from "@/common/js/service";
......
...@@ -6,6 +6,7 @@ import Upload from '@/core/upload'; ...@@ -6,6 +6,7 @@ import Upload from '@/core/upload';
import StoreService from "@/domains/store-domain/storeService"; import StoreService from "@/domains/store-domain/storeService";
import User from "@/common/js/user"; import User from "@/common/js/user";
import Bus from '@/core/tbus'; import Bus from '@/core/tbus';
import ImgClipModal from '@/components/ImgClipModal'
import "./CollegeInfoPage.less"; import "./CollegeInfoPage.less";
let cutFlag = false; let cutFlag = false;
class CollegeInfoPage extends React.Component { class CollegeInfoPage extends React.Component {
...@@ -17,6 +18,7 @@ class CollegeInfoPage extends React.Component { ...@@ -17,6 +18,7 @@ class CollegeInfoPage extends React.Component {
logo:'', logo:'',
showSelectFileModal:false, showSelectFileModal:false,
cutImageBlob: null, cutImageBlob: null,
imageFile: null, // 需要被截取的图片
} }
} }
componentWillMount() { componentWillMount() {
...@@ -51,84 +53,88 @@ class CollegeInfoPage extends React.Component { ...@@ -51,84 +53,88 @@ class CollegeInfoPage extends React.Component {
}) })
} }
handleSelectCover = (file)=> { handleSelectCover = (file)=> {
this.uploadImage(file); // this.uploadImage(file);
this.setState({
visible: true,
imageFile:file
});
} }
//上传图片 //上传图片
uploadImage = (imageFile) => { // uploadImage = (imageFile) => {
const { folderName } = imageFile; // const { folderName } = imageFile;
const fileName = window.random_string(16) + folderName.slice(folderName.lastIndexOf(".")); // const fileName = window.random_string(16) + folderName.slice(folderName.lastIndexOf("."));
const self = this; // const self = this;
this.setState( // this.setState(
{ // {
visible: true, // visible: true,
}, // },
() => { // () => {
setTimeout(() => { // setTimeout(() => {
const okBtnDom = document.querySelector("#headPicModal"); // const okBtnDom = document.querySelector("#headPicModal");
const options = { // const options = {
size: [500, 128], // size: [500, 128],
ok: okBtnDom, // ok: okBtnDom,
maxZoom: 3, // maxZoom: 3,
style: { // style: {
jpgFillColor: "transparent", // jpgFillColor: "transparent",
}, // },
done: function (dataUrl) { // done: function (dataUrl) {
clearTimeout(self.timer); // clearTimeout(self.timer);
self.timer = setTimeout(() => { // self.timer = setTimeout(() => {
if ((self.state.rotate != this.rotate()) || (self.state.scale != this.scale())) { // if ((self.state.rotate != this.rotate()) || (self.state.scale != this.scale())) {
console.log(this.scale(), 'scale') // console.log(this.scale(), 'scale')
const _dataUrl = this.clip() // const _dataUrl = this.clip()
const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl); // const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl);
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl: _dataUrl, // dataUrl: _dataUrl,
rotate: this.rotate(), // rotate: this.rotate(),
scale: this.scale() // scale: this.scale()
}) // })
} // }
}, 500) // }, 500)
const cutImageBlob = self.convertBase64UrlToBlob(dataUrl); // const cutImageBlob = self.convertBase64UrlToBlob(dataUrl);
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl // dataUrl
}) // })
setTimeout(() => { // setTimeout(() => {
cutFlag = false; // cutFlag = false;
}, 2000); // }, 2000);
}, // },
fail: (failInfo) => { // fail: (failInfo) => {
message.error("图片上传失败了,请重新上传"); // message.error("图片上传失败了,请重新上传");
}, // },
loadComplete: function (img) { // loadComplete: function (img) {
setTimeout(() => { // setTimeout(() => {
const _dataUrl = this.clip() // const _dataUrl = this.clip()
self.setState({ // self.setState({
dataUrl: _dataUrl, // dataUrl: _dataUrl,
hasImgReady: true // hasImgReady: true
}) // })
}, 100) // }, 100)
}, // },
}; // };
const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}` // const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}`
if (!this.state.photoclip) { // if (!this.state.photoclip) {
const _photoclip = new PhotoClip("#headPicModal", options); // const _photoclip = new PhotoClip("#headPicModal", options);
_photoclip.load(imgUrl); // _photoclip.load(imgUrl);
this.setState({ // this.setState({
photoclip: _photoclip, // photoclip: _photoclip,
}); // });
} else { // } else {
this.state.photoclip.clear(); // this.state.photoclip.clear();
this.state.photoclip.load(imgUrl); // this.state.photoclip.load(imgUrl);
} // }
}, 200); // }, 200);
} // }
); // );
}; // };
//获取resourceId //获取resourceId
getSignature = (blob, fileName) => { getSignature = (blob, fileName) => {
...@@ -150,16 +156,17 @@ class CollegeInfoPage extends React.Component { ...@@ -150,16 +156,17 @@ class CollegeInfoPage extends React.Component {
logo:coverClicpPath logo:coverClicpPath
}) })
} }
// base64转换成blob
convertBase64UrlToBlob = (urlData) => { // base64转换成blob
const bytes = window.atob(urlData.split(",")[1]); // convertBase64UrlToBlob = (urlData) => {
const ab = new ArrayBuffer(bytes.length); // const bytes = window.atob(urlData.split(",")[1]);
const ia = new Uint8Array(ab); // const ab = new ArrayBuffer(bytes.length);
for (let i = 0; i < bytes.length; i++) { // const ia = new Uint8Array(ab);
ia[i] = bytes.charCodeAt(i); // for (let i = 0; i < bytes.length; i++) {
} // ia[i] = bytes.charCodeAt(i);
return new Blob([ab], { type: "image/png" }); // }
}; // return new Blob([ab], { type: "image/png" });
// };
updateInfo=()=>{ updateInfo=()=>{
const { storeName, logo } = this.state; const { storeName, logo } = this.state;
if(!storeName){ if(!storeName){
...@@ -175,6 +182,7 @@ class CollegeInfoPage extends React.Component { ...@@ -175,6 +182,7 @@ class CollegeInfoPage extends React.Component {
User.setStoreName(storeName); User.setStoreName(storeName);
Bus.trigger('storeNameChange',storeName); Bus.trigger('storeNameChange',storeName);
message.success('保存成功'); message.success('保存成功');
Bus.trigger("updateCollegeInfo")
}); });
} }
render() { render() {
...@@ -185,6 +193,7 @@ class CollegeInfoPage extends React.Component { ...@@ -185,6 +193,7 @@ class CollegeInfoPage extends React.Component {
hasImgReady, hasImgReady,
logo, logo,
cutImageBlob, cutImageBlob,
imageFile
} = this.state; } = this.state;
return ( return (
<div className="page college-info-page"> <div className="page college-info-page">
...@@ -242,7 +251,7 @@ class CollegeInfoPage extends React.Component { ...@@ -242,7 +251,7 @@ class CollegeInfoPage extends React.Component {
onSelect={this.handleSelectCover} onSelect={this.handleSelectCover}
/> />
} }
<Modal {/* <Modal
title="设置图片" title="设置图片"
width={1080} width={1080}
visible={visible} visible={visible}
...@@ -300,7 +309,10 @@ class CollegeInfoPage extends React.Component { ...@@ -300,7 +309,10 @@ class CollegeInfoPage extends React.Component {
</div> </div>
</div> </div>
</div> </div>
</Modal> </Modal> */}
{ visible &&
<ImgClipModal visible={visible} imgUrl={imageFile.ossUrl} aspectRatio='125/32' cropBoxHeight='128' onConfirm={this.getSignature} onClose={()=>{this.setState({ visible: false });}}/>
}
<div><Button type="primary" onClick={this.updateInfo} htmlType="submit" className="submit-btn">更新信息</Button></div> <div><Button type="primary" onClick={this.updateInfo} htmlType="submit" className="submit-btn">更新信息</Button></div>
</div> </div>
......
...@@ -81,4 +81,12 @@ ...@@ -81,4 +81,12 @@
#imgCutModalNew { #imgCutModalNew {
width: 500px; width: 500px;
height: 300px; height: 300px;
}
.preview-url-box{
overflow: hidden;
// img{
// width:500px !important;
// height:282px !important;
// transform:none !important;
// }
} }
\ No newline at end of file
...@@ -175,7 +175,10 @@ class AddLiveClass extends React.Component { ...@@ -175,7 +175,10 @@ class AddLiveClass extends React.Component {
<Tooltip <Tooltip
overlayStyle={{maxWidth: 300, zIndex: '9999'}} overlayStyle={{maxWidth: 300, zIndex: '9999'}}
title={<div style={{width: '266px'}}>支持按上课日期批量创建直播课,创建后按“课程名称_日期”命名,例如:<br/>张三的语文课_9月18日<br/>张三的语文课_9月19日......</div>}> title={<div style={{width: '266px'}}>支持按上课日期批量创建直播课,创建后按“课程名称_日期”命名,例如:<br/>张三的语文课_9月18日<br/>张三的语文课_9月19日......</div>}>
<span className="iconfont">&#xe61d;</span> <span
style={{ color: "rgba(191, 191, 191, 1)",fontWeight: 400 }}
className="iconfont"
>&#xe61d;</span>
</Tooltip> </Tooltip>
</span> </span>
<div> <div>
......
...@@ -175,7 +175,7 @@ class LiveCourseList extends React.Component { ...@@ -175,7 +175,7 @@ class LiveCourseList extends React.Component {
</span> </span>
</div> </div>
<div className='teacher-assistant'> <div className='teacher-assistant'>
{record.teacherName?.length > 4 ? ( {record.teacherName && record.teacherName.length > 4 ? (
<Tooltip title={record.teacherName}> <Tooltip title={record.teacherName}>
<span className='teacher'>讲师:{record.teacherName}</span> <span className='teacher'>讲师:{record.teacherName}</span>
</Tooltip> </Tooltip>
...@@ -303,6 +303,7 @@ class LiveCourseList extends React.Component { ...@@ -303,6 +303,7 @@ class LiveCourseList extends React.Component {
dataIndex: 'created', dataIndex: 'created',
sorter: true, sorter: true,
render: (val, item) => { render: (val, item) => {
// -29000:与后端约定 在初始化学院时,创建时间(标志位-29000)默认展示为'-'
return <span>{val === -29000 ? '-' : formatDate('YYYY-MM-DD H:i', val)}</span>; return <span>{val === -29000 ? '-' : formatDate('YYYY-MM-DD H:i', val)}</span>;
}, },
}, },
...@@ -449,7 +450,7 @@ class LiveCourseList extends React.Component { ...@@ -449,7 +450,7 @@ class LiveCourseList extends React.Component {
</span> </span>
</div> </div>
<div className='teacher-assistant'> <div className='teacher-assistant'>
{record.teacherName.length > 4 ? ( {record.teacherName && record.teacherName.length > 4 ? (
<Tooltip title={record.teacherName}> <Tooltip title={record.teacherName}>
<span className='teacher'>讲师:{record.teacherName}</span> <span className='teacher'>讲师:{record.teacherName}</span>
</Tooltip> </Tooltip>
......
/* /*
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-08-05 10:07:47 * @Date: 2020-08-05 10:07:47
* @LastEditors: fusanqiasng * @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-16 18:16:14 * @LastEditTime: 2021-07-01 14:58:15
* @Description: 图文课新增/编辑页 * @Description: 图文课新增/编辑页
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -25,6 +25,7 @@ import { randomString } from '@/domains/basic-domain/utils'; ...@@ -25,6 +25,7 @@ import { randomString } from '@/domains/basic-domain/utils';
import User from '@/common/js/user'; import User from '@/common/js/user';
import _ from 'underscore'; import _ from 'underscore';
import Upload from '@/core/upload'; import Upload from '@/core/upload';
import ImgClipModal from '@/components/ImgClipModal'
import './AddGraphicsCourse.less'; import './AddGraphicsCourse.less';
const EDIT_BOX_KEY = Math.random(); const EDIT_BOX_KEY = Math.random();
...@@ -279,80 +280,84 @@ class AddGraphicsCourse extends React.Component { ...@@ -279,80 +280,84 @@ class AddGraphicsCourse extends React.Component {
}; };
handleSelectCover = (file) => { handleSelectCover = (file) => {
this.uploadCoverImage(file); // this.uploadCoverImage(file);
this.setState({
visible: true,
imageFile:file
});
}; };
//上传图片 //上传图片
uploadCoverImage = (imageFile) => { // uploadCoverImage = (imageFile) => {
const { folderName } = imageFile; // const { folderName } = imageFile;
const fileName = window.random_string(16) + folderName.slice(folderName.lastIndexOf('.')); // const fileName = window.random_string(16) + folderName.slice(folderName.lastIndexOf('.'));
const self = this; // const self = this;
this.setState( // this.setState(
{ // {
visible: true, // visible: true,
}, // },
() => { // () => {
setTimeout(() => { // setTimeout(() => {
const okBtnDom = document.querySelector('#headPicModal'); // const okBtnDom = document.querySelector('#headPicModal');
const options = { // const options = {
size: [500, 282], // size: [500, 282],
ok: okBtnDom, // ok: okBtnDom,
maxZoom: 3, // maxZoom: 3,
style: { // style: {
jpgFillColor: 'transparent', // jpgFillColor: 'transparent',
}, // },
done: function (dataUrl) { // done: function (dataUrl) {
clearTimeout(self.timer); // clearTimeout(self.timer);
self.timer = setTimeout(() => { // self.timer = setTimeout(() => {
if (self.state.rotate != this.rotate() || self.state.scale != this.scale()) { // if (self.state.rotate != this.rotate() || self.state.scale != this.scale()) {
const _dataUrl = this.clip(); // const _dataUrl = this.clip();
const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl); // const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl);
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl: _dataUrl, // dataUrl: _dataUrl,
rotate: this.rotate(), // rotate: this.rotate(),
scale: this.scale(), // scale: this.scale(),
}); // });
} // }
}, 500); // }, 500);
const cutImageBlob = self.convertBase64UrlToBlob(dataUrl); // const cutImageBlob = self.convertBase64UrlToBlob(dataUrl);
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl, // dataUrl,
}); // });
setTimeout(() => { // setTimeout(() => {
cutFlag = false; // cutFlag = false;
}, 2000); // }, 2000);
}, // },
fail: (failInfo) => { // fail: (failInfo) => {
message.error('图片上传失败了,请重新上传'); // message.error('图片上传失败了,请重新上传');
}, // },
loadComplete: function (img) { // loadComplete: function (img) {
setTimeout(() => { // setTimeout(() => {
const _dataUrl = this.clip(); // const _dataUrl = this.clip();
self.setState({ // self.setState({
dataUrl: _dataUrl, // dataUrl: _dataUrl,
hasImgReady: true, // hasImgReady: true,
}); // });
}, 100); // }, 100);
}, // },
}; // };
const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}`; // const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}`;
if (!this.state.photoclip) { // if (!this.state.photoclip) {
const _photoclip = new PhotoClip('#headPicModal', options); // const _photoclip = new PhotoClip('#headPicModal', options);
_photoclip.load(imgUrl); // _photoclip.load(imgUrl);
this.setState({ // this.setState({
photoclip: _photoclip, // photoclip: _photoclip,
}); // });
} else { // } else {
this.state.photoclip.clear(); // this.state.photoclip.clear();
this.state.photoclip.load(imgUrl); // this.state.photoclip.load(imgUrl);
} // }
}, 200); // }, 200);
} // }
); // );
}; // };
//获取resourceId //获取resourceId
getSignature = (blob, fileName) => { getSignature = (blob, fileName) => {
...@@ -378,15 +383,15 @@ class AddGraphicsCourse extends React.Component { ...@@ -378,15 +383,15 @@ class AddGraphicsCourse extends React.Component {
}; };
// base64转换成blob // base64转换成blob
convertBase64UrlToBlob = (urlData) => { // convertBase64UrlToBlob = (urlData) => {
const bytes = window.atob(urlData.split(',')[1]); // const bytes = window.atob(urlData.split(',')[1]);
const ab = new ArrayBuffer(bytes.length); // const ab = new ArrayBuffer(bytes.length);
const ia = new Uint8Array(ab); // const ia = new Uint8Array(ab);
for (let i = 0; i < bytes.length; i++) { // for (let i = 0; i < bytes.length; i++) {
ia[i] = bytes.charCodeAt(i); // ia[i] = bytes.charCodeAt(i);
} // }
return new Blob([ab], { type: 'image/png' }); // return new Blob([ab], { type: 'image/png' });
}; // };
// 保存 // 保存
handleSubmit = () => { handleSubmit = () => {
...@@ -619,7 +624,7 @@ class AddGraphicsCourse extends React.Component { ...@@ -619,7 +624,7 @@ class AddGraphicsCourse extends React.Component {
onSelect={this.handleSelectCover} onSelect={this.handleSelectCover}
/> />
)} )}
<Modal {/* <Modal
title='设置图片' title='设置图片'
width={1080} width={1080}
visible={visible} visible={visible}
...@@ -652,6 +657,7 @@ class AddGraphicsCourse extends React.Component { ...@@ -652,6 +657,7 @@ class AddGraphicsCourse extends React.Component {
</Button>, </Button>,
]}> ]}>
<div className='clip-box'> <div className='clip-box'>
<div <div
id='headPicModal' id='headPicModal'
ref='headPicModal' ref='headPicModal'
...@@ -673,7 +679,10 @@ class AddGraphicsCourse extends React.Component { ...@@ -673,7 +679,10 @@ class AddGraphicsCourse extends React.Component {
</div> </div>
</div> </div>
</div> </div>
</Modal> </Modal> */}
{ visible &&
<ImgClipModal visible={visible} imgUrl={imageFile.ossUrl} onConfirm={this.getSignature} onClose={()=>{this.setState({ visible: false });}}/>
}
{this.state.previewGraphicsModal} {this.state.previewGraphicsModal}
</div> </div>
); );
......
...@@ -171,8 +171,6 @@ class ManageCoursewareModal extends React.Component { ...@@ -171,8 +171,6 @@ class ManageCoursewareModal extends React.Component {
const that = this; const that = this;
switch (fileType) { switch (fileType) {
case 'PDF': case 'PDF':
// window.open(item.srcDocUrl, "_blank");
// break;
case 'Excel': case 'Excel':
case 'EXCEL': case 'EXCEL':
case 'PPT': case 'PPT':
...@@ -181,27 +179,6 @@ class ManageCoursewareModal extends React.Component { ...@@ -181,27 +179,6 @@ class ManageCoursewareModal extends React.Component {
case 'WORD': case 'WORD':
case 'DOCX': case 'DOCX':
case 'DOC': case 'DOC':
// let size = parseFloat(item.fileSize.replace(/M$|KB$/g, ''));
// if (item.fileSize.includes('KB')) {
// size = 0;
// }
// if (((fileType == 'word' || fileType == 'PPT') && size > 10) || ((fileType == 'Excel') && size > 5)) {
// Modal.confirm({
// title: '抱歉,不能在线预览',
// content: '由于文件较大,不支持在线预览,请下载后再查看',
// icon: <QuestionCircleOutlined />,
// okText:"下载",
// onOk:() => {
// const a = document.createElement('a');
// a.href = item.srcDocUrl;
// a.click();
// }
// });
// } else {
// const scanUrl = "https://view.officeapps.live.com/op/view.aspx?src=" + encodeURIComponent(item.srcDocUrl);
// window.open(scanUrl, "_blank");
// }
if (!item.fileVersionId) { if (!item.fileVersionId) {
this.setState( this.setState(
{ {
......
...@@ -109,13 +109,8 @@ class ShareLiveModal extends React.Component { ...@@ -109,13 +109,8 @@ class ShareLiveModal extends React.Component {
switch (type) { switch (type) {
case 'liveClass': // 直播课 case 'liveClass': // 直播课
if (courseMediaVOS && courseMediaVOS.length > 0) { if (courseMediaVOS && courseMediaVOS.length > 0) {
data.courseMediaVOS.map((item, index) => { const coverItem = courseMediaVOS.filter((item) => item.contentType === 'COVER');
if (item.contentType === 'COVER') { coverImgSrc = coverItem.length === 0 ? 'https://image.xiaomaiketang.com/xm/Yip2YtFDwH.png' : coverItem[0].mediaUrl;
coverImgSrc = item.mediaUrl;
} else {
coverImgSrc = 'https://image.xiaomaiketang.com/xm/Yip2YtFDwH.png';
}
});
} else { } else {
coverImgSrc = 'https://image.xiaomaiketang.com/xm/Yip2YtFDwH.png'; coverImgSrc = 'https://image.xiaomaiketang.com/xm/Yip2YtFDwH.png';
} }
......
/* /*
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-08-05 10:07:47 * @Date: 2020-08-05 10:07:47
* @LastEditors: yuananting * @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-07 15:06:26 * @LastEditTime: 2021-07-01 15:05:12
* @Description: 线下课新增/编辑页 * @Description: 线下课新增/编辑页
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -38,6 +38,7 @@ import moment from 'moment'; ...@@ -38,6 +38,7 @@ import moment from 'moment';
import Upload from '@/core/upload'; import Upload from '@/core/upload';
import GraphicsEditor from '../components/GraphicsEditor'; import GraphicsEditor from '../components/GraphicsEditor';
import MultipleDatePicker from '@/components/MultipleDatePicker'; import MultipleDatePicker from '@/components/MultipleDatePicker';
import ImgClipModal from '@/components/ImgClipModal'
import './AddOfflineCourse.less'; import './AddOfflineCourse.less';
const { Option } = Select; const { Option } = Select;
...@@ -355,83 +356,87 @@ class AddOfflineCourse extends React.Component { ...@@ -355,83 +356,87 @@ class AddOfflineCourse extends React.Component {
} }
handleSelectCover = (file)=> { handleSelectCover = (file)=> {
this.uploadCoverImage(file); // this.uploadCoverImage(file);
this.setState({
visible: true,
imageFile:file
});
} }
//上传图片 //上传图片
uploadCoverImage = (imageFile) => { // uploadCoverImage = (imageFile) => {
const { folderName } = imageFile; // const { folderName } = imageFile;
const fileName = window.random_string(16) + folderName.slice(folderName.lastIndexOf(".")); // const fileName = window.random_string(16) + folderName.slice(folderName.lastIndexOf("."));
const self = this; // const self = this;
this.setState( // this.setState(
{ // {
visible: true, // visible: true,
}, // },
() => { // () => {
setTimeout(() => { // setTimeout(() => {
const okBtnDom = document.querySelector("#headPicModal"); // const okBtnDom = document.querySelector("#headPicModal");
const options = { // const options = {
size: [500, 282], // size: [500, 282],
ok: okBtnDom, // ok: okBtnDom,
maxZoom: 3, // maxZoom: 3,
style: { // style: {
jpgFillColor: "transparent", // jpgFillColor: "transparent",
}, // },
done: function (dataUrl) { // done: function (dataUrl) {
clearTimeout(self.timer); // clearTimeout(self.timer);
self.timer = setTimeout(() => { // self.timer = setTimeout(() => {
if ((self.state.rotate != this.rotate()) || (self.state.scale != this.scale())) { // if ((self.state.rotate != this.rotate()) || (self.state.scale != this.scale())) {
const _dataUrl = this.clip() // const _dataUrl = this.clip()
const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl); // const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl);
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl: _dataUrl, // dataUrl: _dataUrl,
rotate: this.rotate(), // rotate: this.rotate(),
scale: this.scale() // scale: this.scale()
}) // })
} // }
}, 500) // }, 500)
const cutImageBlob = self.convertBase64UrlToBlob(dataUrl); // const cutImageBlob = self.convertBase64UrlToBlob(dataUrl);
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl // dataUrl
}) // })
setTimeout(() => { // setTimeout(() => {
cutFlag = false; // cutFlag = false;
}, 2000); // }, 2000);
}, // },
fail: (failInfo) => { // fail: (failInfo) => {
message.error("图片上传失败了,请重新上传"); // message.error("图片上传失败了,请重新上传");
}, // },
loadComplete: function (img) { // loadComplete: function (img) {
setTimeout(() => { // setTimeout(() => {
const _dataUrl = this.clip() // const _dataUrl = this.clip()
self.setState({ // self.setState({
dataUrl: _dataUrl, // dataUrl: _dataUrl,
hasImgReady: true // hasImgReady: true
}) // })
}, 100) // }, 100)
}, // },
}; // };
const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}` // const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}`
if (!this.state.photoclip) { // if (!this.state.photoclip) {
const _photoclip = new PhotoClip("#headPicModal", options); // const _photoclip = new PhotoClip("#headPicModal", options);
_photoclip.load(imgUrl); // _photoclip.load(imgUrl);
this.setState({ // this.setState({
photoclip: _photoclip, // photoclip: _photoclip,
}); // });
} else { // } else {
this.state.photoclip.clear(); // this.state.photoclip.clear();
this.state.photoclip.load(imgUrl); // this.state.photoclip.load(imgUrl);
} // }
}, 200); // }, 200);
} // }
); // );
}; // };
//获取resourceId //获取resourceId
getSignature = (blob, fileName) => { getSignature = (blob, fileName) => {
...@@ -455,15 +460,15 @@ class AddOfflineCourse extends React.Component { ...@@ -455,15 +460,15 @@ class AddOfflineCourse extends React.Component {
} }
// base64转换成blob // base64转换成blob
convertBase64UrlToBlob = (urlData) => { // convertBase64UrlToBlob = (urlData) => {
const bytes = window.atob(urlData.split(",")[1]); // const bytes = window.atob(urlData.split(",")[1]);
const ab = new ArrayBuffer(bytes.length); // const ab = new ArrayBuffer(bytes.length);
const ia = new Uint8Array(ab); // const ia = new Uint8Array(ab);
for (let i = 0; i < bytes.length; i++) { // for (let i = 0; i < bytes.length; i++) {
ia[i] = bytes.charCodeAt(i); // ia[i] = bytes.charCodeAt(i);
} // }
return new Blob([ab], { type: "image/png" }); // return new Blob([ab], { type: "image/png" });
}; // };
preSubmit = () => { preSubmit = () => {
//过期判断 //过期判断
...@@ -786,6 +791,7 @@ class AddOfflineCourse extends React.Component { ...@@ -786,6 +791,7 @@ class AddOfflineCourse extends React.Component {
quota, quota,
offlinePlace, offlinePlace,
isEditDisablie, isEditDisablie,
imageFile,
} = this.state; } = this.state;
const isDefaultCover = coverUrl === defaultCoverUrl; const isDefaultCover = coverUrl === defaultCoverUrl;
return ( return (
...@@ -1301,7 +1307,7 @@ class AddOfflineCourse extends React.Component { ...@@ -1301,7 +1307,7 @@ class AddOfflineCourse extends React.Component {
onSelect={this.handleSelectCover} onSelect={this.handleSelectCover}
/> />
} }
<Modal {/* <Modal
title="设置图片" title="设置图片"
width={1080} width={1080}
visible={visible} visible={visible}
...@@ -1359,7 +1365,10 @@ class AddOfflineCourse extends React.Component { ...@@ -1359,7 +1365,10 @@ class AddOfflineCourse extends React.Component {
</div> </div>
</div> </div>
</div> </div>
</Modal> </Modal> */}
{ visible &&
<ImgClipModal visible={visible} imgUrl={imageFile.ossUrl} onConfirm={this.getSignature} onClose={()=>{this.setState({ visible: false });}}/>
}
{ this.state.previewOfflineModal } { this.state.previewOfflineModal }
</div> </div>
) )
......
/* /*
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-08-05 10:07:47 * @Date: 2020-08-05 10:07:47
* @LastEditors: wufan * @LastEditors: Please set LastEditors
* @LastEditTime: 2021-05-30 20:35:49 * @LastEditTime: 2021-07-01 13:59:16
* @Description: 视频课新增/编辑页 * @Description: 视频课新增/编辑页
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -11,7 +11,6 @@ import React from 'react' ...@@ -11,7 +11,6 @@ import React from 'react'
import { Button, Input, Radio, message, Modal, Cascader } from 'antd' import { Button, Input, Radio, message, Modal, Cascader } from 'antd'
import { DISK_MAP, FileTypeIcon, FileVerifyMap } from '@/common/constants/academic/lessonEnum' import { DISK_MAP, FileTypeIcon, FileVerifyMap } from '@/common/constants/academic/lessonEnum'
import { ImgCutModalNew } from '@/components'
import ShowTips from '@/components/ShowTips' import ShowTips from '@/components/ShowTips'
import Breadcrumbs from '@/components/Breadcrumbs' import Breadcrumbs from '@/components/Breadcrumbs'
import moment from 'moment' import moment from 'moment'
...@@ -26,8 +25,8 @@ import User from '@/common/js/user' ...@@ -26,8 +25,8 @@ import User from '@/common/js/user'
import _ from 'underscore' import _ from 'underscore'
import Upload from '@/core/upload' import Upload from '@/core/upload'
import { randomString } from '@/domains/basic-domain/utils' import { randomString } from '@/domains/basic-domain/utils'
import ImgClipModal from '@/components/ImgClipModal'
import $ from 'jquery' import $ from 'jquery'
// import PhotoClip from 'photoclip';
import './AddVideoCourse.less' import './AddVideoCourse.less'
const EDIT_BOX_KEY = Math.random() const EDIT_BOX_KEY = Math.random()
...@@ -428,80 +427,84 @@ class AddVideoCourse extends React.Component { ...@@ -428,80 +427,84 @@ class AddVideoCourse extends React.Component {
}) })
} }
handleSelectCover = (file) => { handleSelectCover = (file) => {
this.uploadImage(file) // this.uploadImage(file)
this.setState({
visible: true,
imageFile:file
});
} }
//上传图片 //上传图片
uploadImage = (imageFile) => { // uploadImage = (imageFile) => {
const { folderName } = imageFile // const { folderName } = imageFile
const fileName = window.random_string(16) + folderName.slice(folderName.lastIndexOf('.')) // const fileName = window.random_string(16) + folderName.slice(folderName.lastIndexOf('.'))
const self = this // const self = this
this.setState( // this.setState(
{ // {
visible: true // visible: true
}, // },
() => { // () => {
setTimeout(() => { // setTimeout(() => {
const okBtnDom = document.querySelector('#headPicModal') // const okBtnDom = document.querySelector('#headPicModal')
const options = { // const options = {
size: [500, 282], // size: [500, 282],
ok: okBtnDom, // ok: okBtnDom,
maxZoom: 3, // maxZoom: 3,
style: { // style: {
jpgFillColor: 'transparent' // jpgFillColor: 'transparent'
}, // },
done: function (dataUrl) { // done: function (dataUrl) {
clearTimeout(self.timer) // clearTimeout(self.timer)
self.timer = setTimeout(() => { // self.timer = setTimeout(() => {
if (self.state.rotate != this.rotate() || self.state.scale != this.scale()) { // if (self.state.rotate != this.rotate() || self.state.scale != this.scale()) {
const _dataUrl = this.clip() // const _dataUrl = this.clip()
const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl) // const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl)
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl: _dataUrl, // dataUrl: _dataUrl,
rotate: this.rotate(), // rotate: this.rotate(),
scale: this.scale() // scale: this.scale()
}) // })
} // }
}, 500) // }, 500)
const cutImageBlob = self.convertBase64UrlToBlob(dataUrl) // const cutImageBlob = self.convertBase64UrlToBlob(dataUrl)
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl // dataUrl
}) // })
setTimeout(() => { // setTimeout(() => {
cutFlag = false // cutFlag = false
}, 2000) // }, 2000)
}, // },
fail: (failInfo) => { // fail: (failInfo) => {
message.error('图片上传失败了,请重新上传') // message.error('图片上传失败了,请重新上传')
}, // },
loadComplete: function (img) { // loadComplete: function (img) {
setTimeout(() => { // setTimeout(() => {
const _dataUrl = this.clip() // const _dataUrl = this.clip()
self.setState({ // self.setState({
dataUrl: _dataUrl, // dataUrl: _dataUrl,
hasImgReady: true // hasImgReady: true
}) // })
}, 100) // }, 100)
} // }
} // }
const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}` // const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}`
if (!this.state.photoclip) { // if (!this.state.photoclip) {
const _photoclip = new PhotoClip('#headPicModal', options) // const _photoclip = new PhotoClip('#headPicModal', options)
_photoclip.load(imgUrl) // _photoclip.load(imgUrl)
this.setState({ // this.setState({
photoclip: _photoclip // photoclip: _photoclip
}) // })
} else { // } else {
this.state.photoclip.clear() // this.state.photoclip.clear()
this.state.photoclip.load(imgUrl) // this.state.photoclip.load(imgUrl)
} // }
}, 200) // }, 200)
} // }
) // )
} // }
//获取resourceId //获取resourceId
getSignature = (blob, fileName) => { getSignature = (blob, fileName) => {
...@@ -524,16 +527,16 @@ class AddVideoCourse extends React.Component { ...@@ -524,16 +527,16 @@ class AddVideoCourse extends React.Component {
coverId: coverId coverId: coverId
}) })
} }
// base64转换成blob // // base64转换成blob
convertBase64UrlToBlob = (urlData) => { // convertBase64UrlToBlob = (urlData) => {
const bytes = window.atob(urlData.split(',')[1]) // const bytes = window.atob(urlData.split(',')[1])
const ab = new ArrayBuffer(bytes.length) // const ab = new ArrayBuffer(bytes.length)
const ia = new Uint8Array(ab) // const ia = new Uint8Array(ab)
for (let i = 0; i < bytes.length; i++) { // for (let i = 0; i < bytes.length; i++) {
ia[i] = bytes.charCodeAt(i) // ia[i] = bytes.charCodeAt(i)
} // }
return new Blob([ab], { type: 'image/png' }) // return new Blob([ab], { type: 'image/png' })
} // }
render() { render() {
const { const {
pageType, pageType,
...@@ -736,7 +739,10 @@ class AddVideoCourse extends React.Component { ...@@ -736,7 +739,10 @@ class AddVideoCourse extends React.Component {
onSelect={this.handleSelectCover} onSelect={this.handleSelectCover}
/> />
)} )}
<Modal { visible &&
<ImgClipModal visible={visible} imgUrl={imageFile.ossUrl} onConfirm={this.getSignature} onClose={()=>{this.setState({ visible: false });}}/>
}
{/* <Modal
title='设置图片' title='设置图片'
width={1080} width={1080}
visible={visible} visible={visible}
...@@ -790,7 +796,7 @@ class AddVideoCourse extends React.Component { ...@@ -790,7 +796,7 @@ class AddVideoCourse extends React.Component {
</div> </div>
</div> </div>
</div> </div>
</Modal> </Modal> */}
{this.state.previewCourseModal} {this.state.previewCourseModal}
</div> </div>
) )
......
...@@ -147,7 +147,7 @@ class VideoCourseList extends React.Component { ...@@ -147,7 +147,7 @@ class VideoCourseList extends React.Component {
关闭后,学院内不再展示此课程,但学员仍可通过分享的海报/链接查看此课程。 关闭后,学院内不再展示此课程,但学员仍可通过分享的海报/链接查看此课程。
</div> </div>
}> }>
<i className='icon iconfont' style={{ marginLeft: '5px', cursor: 'pointer', color: '#bfbfbf', fontSize: '14px' }}> <i className='icon iconfont' style={{ marginLeft: '5px', cursor: 'pointer', color: '#bfbfbf', fontSize: '14px', fontWeight: 'normal' }}>
&#xe61d; &#xe61d;
</i> </i>
</Tooltip> </Tooltip>
......
/* /*
* @Author: zhangleyuan * @Author: zhangleyuan
* @Date: 2021-02-20 16:45:51 * @Date: 2021-02-20 16:45:51
* @LastEditors: fusanqiasng * @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-01 15:20:33 * @LastEditTime: 2021-07-01 15:08:17
* @Description: 描述一下 * @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -12,7 +12,7 @@ import { withRouter } from 'react-router-dom'; ...@@ -12,7 +12,7 @@ import { withRouter } from 'react-router-dom';
import SelectOperatorModal from '../modal/SelectOperatorModal'; import SelectOperatorModal from '../modal/SelectOperatorModal';
import SelectPrepareFileModal from '@/modules/prepare-lesson/modal/SelectPrepareFileModal'; import SelectPrepareFileModal from '@/modules/prepare-lesson/modal/SelectPrepareFileModal';
import Upload from '@/core/upload'; import Upload from '@/core/upload';
// import PhotoClip from 'photoclip' import ImgClipModal from '@/components/ImgClipModal'
import './BasicInfo.less'; import './BasicInfo.less';
const { TextArea } = Input; const { TextArea } = Input;
...@@ -22,6 +22,7 @@ class BasicInfo extends React.Component { ...@@ -22,6 +22,7 @@ class BasicInfo extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
imageFile: null, // 需要被截取的图片
operatorModalVisible: false, operatorModalVisible: false,
showSelectFileModal: false, showSelectFileModal: false,
cutImageBlob: null, cutImageBlob: null,
...@@ -71,79 +72,83 @@ class BasicInfo extends React.Component { ...@@ -71,79 +72,83 @@ class BasicInfo extends React.Component {
}, 1000); }, 1000);
}; };
handleSelectCover = (file) => { handleSelectCover = (file) => {
this.uploadImage(file); // this.uploadImage(file);
this.setState({
visible: true,
imageFile:file
});
}; };
//上传图片 //上传图片
uploadImage = (imageFile) => { // uploadImage = (imageFile) => {
const self = this; // const self = this;
this.setState( // this.setState(
{ // {
visible: true, // visible: true,
}, // },
() => { // () => {
setTimeout(() => { // setTimeout(() => {
const okBtnDom = document.querySelector('#headPicModal'); // const okBtnDom = document.querySelector('#headPicModal');
const options = { // const options = {
size: [500, 282], // size: [500, 282],
ok: okBtnDom, // ok: okBtnDom,
maxZoom: 3, // maxZoom: 3,
style: { // style: {
jpgFillColor: 'transparent', // jpgFillColor: 'transparent',
}, // },
done: function (dataUrl) { // done: function (dataUrl) {
clearTimeout(self.timer); // clearTimeout(self.timer);
self.timer = setTimeout(() => { // self.timer = setTimeout(() => {
if (self.state.rotate !== this.rotate() || self.state.scale !== this.scale()) { // if (self.state.rotate !== this.rotate() || self.state.scale !== this.scale()) {
console.log(this.scale(), 'scale'); // console.log(this.scale(), 'scale');
const _dataUrl = this.clip(); // const _dataUrl = this.clip();
const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl); // const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl);
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl: _dataUrl, // dataUrl: _dataUrl,
rotate: this.rotate(), // rotate: this.rotate(),
scale: this.scale(), // scale: this.scale(),
}); // });
} // }
}, 500); // }, 500);
const cutImageBlob = self.convertBase64UrlToBlob(dataUrl); // const cutImageBlob = self.convertBase64UrlToBlob(dataUrl);
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl, // dataUrl,
}); // });
setTimeout(() => { // setTimeout(() => {
cutFlag = false; // cutFlag = false;
}, 2000); // }, 2000);
}, // },
fail: (failInfo) => { // fail: (failInfo) => {
message.error('图片上传失败了,请重新上传'); // message.error('图片上传失败了,请重新上传');
}, // },
loadComplete: function (img) { // loadComplete: function (img) {
setTimeout(() => { // setTimeout(() => {
const _dataUrl = this.clip(); // const _dataUrl = this.clip();
self.setState({ // self.setState({
dataUrl: _dataUrl, // dataUrl: _dataUrl,
hasImgReady: true, // hasImgReady: true,
}); // });
}, 100); // }, 100);
}, // },
}; // };
const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}`; // const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}`;
if (!this.state.photoclip) { // if (!this.state.photoclip) {
const _photoclip = new PhotoClip('#headPicModal', options); // const _photoclip = new PhotoClip('#headPicModal', options);
_photoclip.load(imgUrl); // _photoclip.load(imgUrl);
this.setState({ // this.setState({
photoclip: _photoclip, // photoclip: _photoclip,
}); // });
} else { // } else {
this.state.photoclip.clear(); // this.state.photoclip.clear();
this.state.photoclip.load(imgUrl); // this.state.photoclip.load(imgUrl);
} // }
}, 200); // }, 200);
} // }
); // );
}; // };
//获取resourceId //获取resourceId
getSignature = (blob, fileName) => { getSignature = (blob, fileName) => {
...@@ -169,15 +174,15 @@ class BasicInfo extends React.Component { ...@@ -169,15 +174,15 @@ class BasicInfo extends React.Component {
}, 1000); }, 1000);
}; };
// base64转换成blob // base64转换成blob
convertBase64UrlToBlob = (urlData) => { // convertBase64UrlToBlob = (urlData) => {
const bytes = window.atob(urlData.split(',')[1]); // const bytes = window.atob(urlData.split(',')[1]);
const ab = new ArrayBuffer(bytes.length); // const ab = new ArrayBuffer(bytes.length);
const ia = new Uint8Array(ab); // const ia = new Uint8Array(ab);
for (let i = 0; i < bytes.length; i++) { // for (let i = 0; i < bytes.length; i++) {
ia[i] = bytes.charCodeAt(i); // ia[i] = bytes.charCodeAt(i);
} // }
return new Blob([ab], { type: 'image/png' }); // return new Blob([ab], { type: 'image/png' });
}; // };
limitNumber = (value) => { limitNumber = (value) => {
if (typeof value === 'string') { if (typeof value === 'string') {
return !isNaN(Number(value)) ? value.replace(/^(0+)|[^\d]/g, '') : ''; return !isNaN(Number(value)) ? value.replace(/^(0+)|[^\d]/g, '') : '';
...@@ -203,7 +208,7 @@ class BasicInfo extends React.Component { ...@@ -203,7 +208,7 @@ class BasicInfo extends React.Component {
}; };
render() { render() {
const { operatorModalVisible, showSelectFileModal, visible, hasImgReady, cutImageBlob } = this.state; const { operatorModalVisible, showSelectFileModal, visible, hasImgReady, cutImageBlob,imageFile} = this.state;
const { data } = this.props; const { data } = this.props;
const { planName, coverUrl, instro, enableState, operateType, selectOperatorList, percentCompleteLive, percentCompleteVideo, percentCompletePicture } = const { planName, coverUrl, instro, enableState, operateType, selectOperatorList, percentCompleteLive, percentCompleteVideo, percentCompletePicture } =
data; data;
...@@ -403,7 +408,7 @@ class BasicInfo extends React.Component { ...@@ -403,7 +408,7 @@ class BasicInfo extends React.Component {
onSelect={this.handleSelectCover} onSelect={this.handleSelectCover}
/> />
)} )}
<Modal {/* <Modal
title='设置图片' title='设置图片'
width={1080} width={1080}
visible={visible} visible={visible}
...@@ -457,7 +462,10 @@ class BasicInfo extends React.Component { ...@@ -457,7 +462,10 @@ class BasicInfo extends React.Component {
</div> </div>
</div> </div>
</div> </div>
</Modal> </Modal> */}
{ visible &&
<ImgClipModal visible={visible} imgUrl={imageFile.ossUrl} onConfirm={this.getSignature} onClose={()=>{this.setState({ visible: false });}}/>
}
</div> </div>
); );
} }
......
...@@ -330,7 +330,7 @@ class UserLearningData extends React.Component { ...@@ -330,7 +330,7 @@ class UserLearningData extends React.Component {
<span> <span>
<span>学习进度</span> <span>学习进度</span>
<Tooltip title='学员培训计划中达到“已完成”状态的课程数/总课程数'> <Tooltip title='学员培训计划中达到“已完成”状态的课程数/总课程数'>
<i className='icon iconfont' style={{ marginLeft: '5px', cursor: 'pointer', color: '#bfbfbf', fontSize: '14px' }}> <i className='icon iconfont' style={{ marginLeft: '5px', cursor: 'pointer', color: '#bfbfbf', fontSize: '14px', fontWeight: 'normal' }}>
&#xe61d; &#xe61d;
</i> </i>
</Tooltip> </Tooltip>
......
...@@ -436,7 +436,7 @@ class SelectPrepareFileModal extends React.Component { ...@@ -436,7 +436,7 @@ class SelectPrepareFileModal extends React.Component {
selectType, selectType,
multiple, multiple,
accept = ".ppt,.pptx,.doc,.docx,.pdf,.jpg,.jpeg,.png,.mp3,.mp4,.xlsx,.xls", accept = ".ppt,.pptx,.doc,.docx,.pdf,.jpg,.jpeg,.png,.mp3,.mp4,.xlsx,.xls",
tooltip = '支持文件类型:ppt、word、excel、pdf、jpg、jpeg、png、mp3、mp4' tooltip = '支持文件类型:ppt、word、excel、pdf、jpg、jpeg、png、mp3、mp4,支持批量上传文件'
} = this.props; } = this.props;
const selectedFileLength = selectedFileList.length; const selectedFileLength = selectedFileList.length;
......
...@@ -121,40 +121,6 @@ class FolderList extends React.Component { ...@@ -121,40 +121,6 @@ class FolderList extends React.Component {
break; break;
} }
} }
// getYoZoSign = (data,type,folderName)=>{
// return new Promise((resolve) => {
// let uploadParams;
// if(type==="UPLOAD"){
// uploadParams ={
// fileUrl:data,
// instId:window.currentUserInstInfo.instId,
// yoZoTypeEnum:'UPLOAD'
// }
// }else{
// uploadParams ={
// fileVersionId:data,
// instId:window.currentUserInstInfo.instId,
// yoZoTypeEnum:'VIEW',
// htmlTitle:folderName
// }
// }
// Service.Apollo('public/apollo/getYoZoSign', uploadParams).then(res => {
// const { result = [] } = res;
// resolve(result)
// });
// })
// }
// saveYoZoFileVersionId = (fileVersionId,folderId)=>{
// const params ={
// fileVersionId,
// folderId,
// instId: window.currentUserInstInfo.instId,
// }
// Service.Apollo('public/apollo/saveYoZoFileVersionId', params).then(res => {
// });
// }
// 预览文件 // 预览文件
handleScanFile = async (folder) => { handleScanFile = async (folder) => {
const { folderFormat, folderSize, ossUrl,rights,fileVersionId,id,folderName} = folder; const { folderFormat, folderSize, ossUrl,rights,fileVersionId,id,folderName} = folder;
...@@ -843,7 +809,7 @@ class FolderList extends React.Component { ...@@ -843,7 +809,7 @@ class FolderList extends React.Component {
<Choose> <Choose>
<When condition={hasManagementAuthority}> <When condition={hasManagementAuthority}>
<div className="lottie-icon-title">你还没有上传文件,点击 <div className="lottie-icon-title">你还没有上传文件,点击
<Tooltip title="支持文件类型:ppt、word、excel、pdf、jpg、mp3、mp4"> <Tooltip title="支持文件类型:ppt、word、excel、pdf、jpg、mp3、mp4,上传后默认私密,可邀请其他成员协作,支持批量上传文件">
<span <span
className="upload-btn" className="upload-btn"
onClick={this.handleChooseFile} onClick={this.handleChooseFile}
......
...@@ -314,7 +314,7 @@ class OperateArea extends React.Component { ...@@ -314,7 +314,7 @@ class OperateArea extends React.Component {
accept=".ppt,.pptx,.doc,.docx,.pdf,.jpg,.jpeg,.png,.mp3,.mp4,.xlsx,.xls" accept=".ppt,.pptx,.doc,.docx,.pdf,.jpg,.jpeg,.png,.mp3,.mp4,.xlsx,.xls"
onChange={(e) => this.handleUpload(e)} onChange={(e) => this.handleUpload(e)}
/> />
<Tooltip title="支持文件类型:ppt、word、excel、pdf、jpg、mp3、mp4,上传后默认私密,可邀请其他成员协作"> <Tooltip title="支持文件类型:ppt、word、excel、pdf、jpg、mp3、mp4,上传后默认私密,可邀请其他成员协作,支持批量上传文件">
<Button <Button
type={!showResultPage?"primary":""} type={!showResultPage?"primary":""}
disabled={showResultPage} disabled={showResultPage}
......
...@@ -5,6 +5,7 @@ import Service from "@/common/js/service"; ...@@ -5,6 +5,7 @@ import Service from "@/common/js/service";
import BaseService from "@/domains/basic-domain/baseService"; import BaseService from "@/domains/basic-domain/baseService";
import User from "@/common/js/user"; import User from "@/common/js/user";
import Breadcrumbs from "@/components/Breadcrumbs"; import Breadcrumbs from "@/components/Breadcrumbs";
import ImgClipModal from '@/components/ImgClipModal'
import './CreateCollege.less'; import './CreateCollege.less';
let cutFlag = false; let cutFlag = false;
...@@ -18,6 +19,7 @@ export default class CreateCollege extends React.Component { ...@@ -18,6 +19,7 @@ export default class CreateCollege extends React.Component {
logo: 'https://image.xiaomaiketang.com/xm/fe4NCjr7XF.png', logo: 'https://image.xiaomaiketang.com/xm/fe4NCjr7XF.png',
name: '', name: '',
enterpriseId: User.getEnterpriseId(), enterpriseId: User.getEnterpriseId(),
imageFile: null, // 需要被截取的图片
}; };
this.loginInputRef = React.createRef() this.loginInputRef = React.createRef()
} }
...@@ -46,95 +48,99 @@ export default class CreateCollege extends React.Component { ...@@ -46,95 +48,99 @@ export default class CreateCollege extends React.Component {
handleSelectCover = (e) => { handleSelectCover = (e) => {
const imageFile = e.target.files[0]; const imageFile = e.target.files[0];
Upload.uploadBlobToOSS(imageFile, 'cover' + (new Date()).valueOf()).then((url) => { Upload.uploadBlobToOSS(imageFile, 'cover' + (new Date()).valueOf()).then((url) => {
this.uploadImage({ folderName: imageFile.name, ossUrl: url }); this.setState({
visible: true,
imageFile:{ folderName: imageFile.name, ossUrl: url }
});
// this.uploadImage({ folderName: imageFile.name, ossUrl: url });
}) })
} }
//上传图片 //上传图片
uploadImage = (imageFile) => { // uploadImage = (imageFile) => {
const { folderName } = imageFile; // const { folderName } = imageFile;
const fileName = window.random_string(16) + folderName.slice(folderName.lastIndexOf(".")); // const fileName = window.random_string(16) + folderName.slice(folderName.lastIndexOf("."));
const self = this; // const self = this;
this.setState( // this.setState(
{ // {
visible: true, // visible: true,
}, // },
() => { // () => {
setTimeout(() => { // setTimeout(() => {
const okBtnDom = document.querySelector("#headPicModal"); // const okBtnDom = document.querySelector("#headPicModal");
const options = { // const options = {
size: [500, 128], // size: [500, 128],
ok: okBtnDom, // ok: okBtnDom,
maxZoom: 3, // maxZoom: 3,
style: { // style: {
jpgFillColor: "transparent", // jpgFillColor: "transparent",
}, // },
done: function (dataUrl) { // done: function (dataUrl) {
clearTimeout(self.timer); // clearTimeout(self.timer);
self.timer = setTimeout(() => { // self.timer = setTimeout(() => {
if ((self.state.rotate != this.rotate()) || (self.state.scale != this.scale())) { // if ((self.state.rotate != this.rotate()) || (self.state.scale != this.scale())) {
const _dataUrl = this.clip() // const _dataUrl = this.clip()
const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl); // const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl);
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl: _dataUrl, // dataUrl: _dataUrl,
rotate: this.rotate(), // rotate: this.rotate(),
scale: this.scale() // scale: this.scale()
}) // })
} // }
}, 500) // }, 500)
const cutImageBlob = self.convertBase64UrlToBlob(dataUrl); // const cutImageBlob = self.convertBase64UrlToBlob(dataUrl);
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl // dataUrl
}) // })
setTimeout(() => { // setTimeout(() => {
cutFlag = false; // cutFlag = false;
}, 2000); // }, 2000);
}, // },
fail: (failInfo) => { // fail: (failInfo) => {
message.error("图片上传失败了,请重新上传"); // message.error("图片上传失败了,请重新上传");
}, // },
loadComplete: function (img) { // loadComplete: function (img) {
setTimeout(() => { // setTimeout(() => {
const _dataUrl = this.clip() // const _dataUrl = this.clip()
self.setState({ // self.setState({
dataUrl: _dataUrl, // dataUrl: _dataUrl,
hasImgReady: true // hasImgReady: true
}) // })
}, 100) // }, 100)
}, // },
}; // };
const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}` // const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}`
if (!this.state.photoclip) { // if (!this.state.photoclip) {
const _photoclip = new PhotoClip("#headPicModal", options); // const _photoclip = new PhotoClip("#headPicModal", options);
_photoclip.load(imgUrl); // _photoclip.load(imgUrl);
this.setState({ // this.setState({
photoclip: _photoclip, // photoclip: _photoclip,
}); // });
} else { // } else {
this.state.photoclip.clear(); // this.state.photoclip.clear();
this.state.photoclip.load(imgUrl); // this.state.photoclip.load(imgUrl);
} // }
}, 200); // }, 200);
} // }
); // );
}; // };
// base64转换成blob // base64转换成blob
convertBase64UrlToBlob = (urlData) => { // convertBase64UrlToBlob = (urlData) => {
const bytes = window.atob(urlData.split(",")[1]); // const bytes = window.atob(urlData.split(",")[1]);
const ab = new ArrayBuffer(bytes.length); // const ab = new ArrayBuffer(bytes.length);
const ia = new Uint8Array(ab); // const ia = new Uint8Array(ab);
for (let i = 0; i < bytes.length; i++) { // for (let i = 0; i < bytes.length; i++) {
ia[i] = bytes.charCodeAt(i); // ia[i] = bytes.charCodeAt(i);
} // }
return new Blob([ab], { type: "image/png" }); // return new Blob([ab], { type: "image/png" });
}; // };
//获取resourceId //获取resourceId
getSignature = (blob, fileName) => { getSignature = (blob, fileName) => {
...@@ -184,6 +190,7 @@ export default class CreateCollege extends React.Component { ...@@ -184,6 +190,7 @@ export default class CreateCollege extends React.Component {
hasImgReady, hasImgReady,
cutImageBlob, cutImageBlob,
showError, showError,
imageFile
} = this.state; } = this.state;
return ( return (
<div className="college-manage-page"> <div className="college-manage-page">
...@@ -247,7 +254,7 @@ export default class CreateCollege extends React.Component { ...@@ -247,7 +254,7 @@ export default class CreateCollege extends React.Component {
style={{ display: "none" }} style={{ display: "none" }}
onChange={this.handleSelectCover} onChange={this.handleSelectCover}
/> />
<Modal {/* <Modal
title="设置图片" title="设置图片"
width={1080} width={1080}
visible={visible} visible={visible}
...@@ -305,7 +312,10 @@ export default class CreateCollege extends React.Component { ...@@ -305,7 +312,10 @@ export default class CreateCollege extends React.Component {
</div> </div>
</div> </div>
</div> </div>
</Modal> </Modal> */}
{ visible &&
<ImgClipModal visible={visible} imgUrl={imageFile.ossUrl} aspectRatio='125/32' cropBoxHeight='128' onConfirm={this.getSignature} onClose={()=>{this.setState({ visible: false });}}/>
}
</div> </div>
) )
} }
......
...@@ -32,26 +32,6 @@ function Login(props) { ...@@ -32,26 +32,6 @@ function Login(props) {
*/ */
useEffect(() => { useEffect(() => {
// const enterpriseId = getParameterByName('enterpriseId');
// const userId = getParameterByName('userId');
// const from = getParameterByName('from');
// const storeId = getParameterByName('storeId');
// if (storeId) {
// User.setCustomerStoreId(storeId);
// }
// if (from === 'customer' && enterpriseId && userId) {
// if (!user.getToken() || enterpriseId !== user.getEnterpriseId() || userId !== User.getUserId()) {
// getWXWorkLoginNoCheck(enterpriseId, userId);
// } else {
// window.RCHistory.push({
// pathname: `/switch-route`,
// });
// }
// } else {
// User.removeUserId();
// User.removeToken();
// User.removeEnterpriseId();
// }
User.removeUserId(); User.removeUserId();
User.removeToken(); User.removeToken();
User.removeEnterpriseId(); User.removeEnterpriseId();
......
...@@ -51,12 +51,13 @@ ...@@ -51,12 +51,13 @@
display: -webkit-flex; display: -webkit-flex;
flex-direction: column; flex-direction: column;
-webkit-flex-direction: column; -webkit-flex-direction: column;
height: calc(~'100% - 60px');
.nav { .nav {
-webkit-flex: 1; -webkit-flex: 1;
cursor: default; cursor: default;
font-size: 16px; font-size: 16px;
height: calc(~'100% - 72px'); height: calc(~'100% - 84px');
overflow: auto; overflow: auto;
&::-webkit-scrollbar { &::-webkit-scrollbar {
display: none; display: none;
...@@ -134,6 +135,121 @@ ...@@ -134,6 +135,121 @@
color: #5e606a; color: #5e606a;
} }
} }
.version-info {
// position: absolute;
height: 84px;
bottom: 0;
width: 180px;
cursor: pointer;
// z-index: 10;
padding-top: 10px;
background-color: white;
.row-1 {
width: fit-content;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
line-height: 20px;
margin: 0 auto;
.version-name {
display: inline-block;
width: 58px;
text-align: center;
color: #333333;
margin: 0 auto;
border-radius: 2px;
border: 1px solid #E8E8E8;
}
.renew {
display: inline-block;
width: 58px;
color: #2966FF;
margin-left: 8px;
}
}
.expiration-time {
height: 24px;
text-align: center;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
line-height: 22px;
margin: 6px auto 0 auto;
}
.popover {
display: none;
position: absolute;
z-index: 100;
padding: 16px 22px;
bottom: 22px;
width: 352px;
height: 198px;
right: -342px;
background: #FFFFFF;
box-shadow: 0px 2px 15px 0px rgba(0, 0, 0, 0.06);
.title {
display: inline-block;
width: 68px;
height: 22px;
font-size: 16px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333333;
line-height: 22px;
margin-right: 8px;
}
.expiration-tag {
display: inline-block;
width: 52px;
height: 18px;
background: #EEEEEE;
border-radius: 2px;
text-align: center;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
line-height: 17px;
}
&::before {
position: absolute;
content: "";
width: 16px;
height: 16px;
left: -8px;
top: 80%;
border: 8px solid transparent;
box-shadow: 0px 2px 15px 0px rgba(0, 0, 0, 0.06);
}
.content {
margin-top: 24px;
.widget {
display: inline-block;
}
.lable {
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 22px;
}
.lable-text {
margin-top: 4px;
font-size: 16px;
font-weight: 500;
color: #333333;
line-height: 22px;
}
}
}
.popover-show {
display: block;
}
}
} }
&.left-container-vertical { &.left-container-vertical {
...@@ -155,120 +271,7 @@ ...@@ -155,120 +271,7 @@
// display:inline-block; // display:inline-block;
// } // }
// } // }
.version-info {
position: absolute;
height: 84px;
bottom: 0;
width: 100%;
cursor: pointer;
z-index: 10;
padding-top: 10px;
background-color: white;
.row-1 {
width: fit-content;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
line-height: 20px;
margin: 0 auto;
.version-name {
display: inline-block;
width: 58px;
text-align: center;
color: #333333;
margin: 0 auto;
border-radius: 2px;
border: 1px solid #E8E8E8;
}
.renew {
display: inline-block;
width: 58px;
color: #2966FF;
margin-left: 8px;
}
}
.expiration-time {
height: 24px;
text-align: center;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
line-height: 22px;
margin: 6px auto 0 auto;
}
.popover {
display: none;
position: absolute;
z-index: 100;
padding: 16px 22px;
bottom: 22px;
width: 352px;
height: 198px;
right: -342px;
background: #FFFFFF;
box-shadow: 0px 2px 15px 0px rgba(0, 0, 0, 0.06);
.title {
display: inline-block;
width: 68px;
height: 22px;
font-size: 16px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333333;
line-height: 22px;
margin-right: 8px;
}
.expiration-tag {
display: inline-block;
width: 52px;
height: 18px;
background: #EEEEEE;
border-radius: 2px;
text-align: center;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
line-height: 17px;
}
&::before {
position: absolute;
content: "";
width: 16px;
height: 16px;
left: -8px;
top: 80%;
border: 8px solid transparent;
box-shadow: 0px 2px 15px 0px rgba(0, 0, 0, 0.06);
}
.content {
margin-top: 24px;
.widget {
display: inline-block;
}
.lable {
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 22px;
}
.lable-text {
margin-top: 4px;
font-size: 16px;
font-weight: 500;
color: #333333;
line-height: 22px;
}
}
}
.popover-show {
display: block;
}
}
} }
.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected { .ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected {
......
...@@ -6,6 +6,7 @@ import classNames from 'classnames'; ...@@ -6,6 +6,7 @@ import classNames from 'classnames';
import React, { Key, useContext, useEffect, useMemo, useState } from 'react'; import React, { Key, useContext, useEffect, useMemo, useState } from 'react';
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom';
import _ from 'underscore'; import _ from 'underscore';
import Bus from '@/core/tbus';
import { menuList } from '../../routes//config/menuList'; import { menuList } from '../../routes//config/menuList';
import { VersionContext, XMContext } from '../../store/context'; import { VersionContext, XMContext } from '../../store/context';
import './Menu.less'; import './Menu.less';
...@@ -132,11 +133,20 @@ function Aside(props: any) { ...@@ -132,11 +133,20 @@ function Aside(props: any) {
}); });
} }
return item; return item;
}); })
}, [props.location.pathname]); }, [props.location.pathname])
useEffect(() => {
getTopLeftLogo(); useEffect(()=> {
}, []); getTopLeftLogo()
Bus.bind("updateCollegeInfo",updateCollegeInfo)
return ()=> {
Bus.unbind("updateCollegeInfo",updateCollegeInfo)
}
},[])
function updateCollegeInfo() {
getTopLeftLogo()
}
function getTopLeftLogo() { function getTopLeftLogo() {
if (User.getToken()) { if (User.getToken()) {
...@@ -273,8 +283,11 @@ function Aside(props: any) { ...@@ -273,8 +283,11 @@ function Aside(props: any) {
})} })}
</Menu> </Menu>
</div> </div>
</div> {
{menuType ? <VersionPanel /> : ''} menuType ? <VersionPanel /> : ""
}
</div>
</div> </div>
); );
} }
......
/* /*
* @Author: wufan * @Author: wufan
* @Date: 2020-11-30 10:47:38 * @Date: 2020-11-30 10:47:38
* @LastEditors: wufan * @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-21 11:16:21 * @LastEditTime: 2021-07-01 15:38:47
* @Description: web学院banner页面 * @Description: web学院banner页面
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -25,6 +25,7 @@ import "./StoreDecorationPage.less"; ...@@ -25,6 +25,7 @@ import "./StoreDecorationPage.less";
import Upload from "@/core/upload"; import Upload from "@/core/upload";
import { XMTable } from '@/components'; import { XMTable } from '@/components';
import college from '@/common/lottie/college'; import college from '@/common/lottie/college';
import ImgClipModal from '@/components/ImgClipModal'
const { confirm } = Modal; const { confirm } = Modal;
const DragHandle = sortableHandle(() => ( const DragHandle = sortableHandle(() => (
...@@ -51,7 +52,8 @@ class StoreH5Decoration extends React.Component { ...@@ -51,7 +52,8 @@ class StoreH5Decoration extends React.Component {
photoclip: null, photoclip: null,
preview: "", preview: "",
cutImageBlob: null, cutImageBlob: null,
hasImgReady: false // 图片是否上传成功 hasImgReady: false, // 图片是否上传成功
imageFile: null // 需要被截取的图片
}; };
} }
...@@ -211,84 +213,91 @@ class StoreH5Decoration extends React.Component { ...@@ -211,84 +213,91 @@ class StoreH5Decoration extends React.Component {
this.setState({ this.setState({
showSelectFileModal: false, showSelectFileModal: false,
}); });
this.uploadImage(file); // this.uploadImage(file);
if(file){
this.setState({
visible: true,
imageFile:file
});
}
}; };
//上传图片 //上传图片
uploadImage = (imageFile) => { // uploadImage = (imageFile) => {
const self = this; // const self = this;
this.setState( // this.setState(
{ // {
visible: true, // visible: true,
}, // },
() => { // () => {
setTimeout(() => { // setTimeout(() => {
const okBtnDom = document.querySelector("#headPicModal"); // const okBtnDom = document.querySelector("#headPicModal");
const options = { // const options = {
size: [500, 172], // size: [500, 172],
ok: okBtnDom, // ok: okBtnDom,
maxZoom: 3, // maxZoom: 3,
style: { // style: {
jpgFillColor: "transparent", // jpgFillColor: "transparent",
}, // },
done: function (dataUrl) { // done: function (dataUrl) {
clearTimeout(self.timer); // clearTimeout(self.timer);
self.timer = setTimeout(() => { // self.timer = setTimeout(() => {
if ((self.state.rotate != this.rotate()) || (self.state.scale != this.scale())) { // if ((self.state.rotate != this.rotate()) || (self.state.scale != this.scale())) {
console.log(this.scale(), 'scale') // console.log(this.scale(), 'scale')
const _dataUrl = this.clip() // const _dataUrl = this.clip()
const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl); // const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl);
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl: _dataUrl, // dataUrl: _dataUrl,
rotate: this.rotate(), // rotate: this.rotate(),
scale: this.scale() // scale: this.scale()
}) // })
} // }
}, 500) // }, 500)
const cutImageBlob = self.convertBase64UrlToBlob(dataUrl); // const cutImageBlob = self.convertBase64UrlToBlob(dataUrl);
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl // dataUrl
}) // })
setTimeout(() => { // setTimeout(() => {
cutFlag = false; // cutFlag = false;
}, 2000); // }, 2000);
}, // },
fail: (failInfo) => { // fail: (failInfo) => {
message.error("图片上传失败了,请重新上传"); // message.error("图片上传失败了,请重新上传");
}, // },
loadComplete: function (img) { // loadComplete: function (img) {
setTimeout(() => { // setTimeout(() => {
const _dataUrl = this.clip() // const _dataUrl = this.clip()
self.setState({ // self.setState({
dataUrl: _dataUrl, // dataUrl: _dataUrl,
hasImgReady: true // hasImgReady: true
}) // })
}, 100) // }, 100)
}, // },
}; // };
const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}` // const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}`
if (!this.state.photoclip) { // if (!this.state.photoclip) {
const _photoclip = new PhotoClip("#headPicModal", options); // const _photoclip = new PhotoClip("#headPicModal", options);
_photoclip.load(imgUrl); // _photoclip.load(imgUrl);
this.setState({ // this.setState({
photoclip: _photoclip, // photoclip: _photoclip,
}); // });
} else { // } else {
this.state.photoclip.clear(); // this.state.photoclip.clear();
this.state.photoclip.load(imgUrl); // this.state.photoclip.load(imgUrl);
} // }
}, 200); // }, 200);
} // }
); // );
}; // };
//获取resourceId //获取resourceId
getSignature = (blob) => { getSignature = (blob) => {
...@@ -345,15 +354,15 @@ class StoreH5Decoration extends React.Component { ...@@ -345,15 +354,15 @@ class StoreH5Decoration extends React.Component {
}; };
// base64转换成blob // base64转换成blob
convertBase64UrlToBlob = (urlData) => { // convertBase64UrlToBlob = (urlData) => {
const bytes = window.atob(urlData.split(",")[1]); // const bytes = window.atob(urlData.split(",")[1]);
const ab = new ArrayBuffer(bytes.length); // const ab = new ArrayBuffer(bytes.length);
const ia = new Uint8Array(ab); // const ia = new Uint8Array(ab);
for (let i = 0; i < bytes.length; i++) { // for (let i = 0; i < bytes.length; i++) {
ia[i] = bytes.charCodeAt(i); // ia[i] = bytes.charCodeAt(i);
} // }
return new Blob([ab], { type: "image/png" }); // return new Blob([ab], { type: "image/png" });
}; // };
render() { render() {
const { const {
...@@ -362,7 +371,8 @@ class StoreH5Decoration extends React.Component { ...@@ -362,7 +371,8 @@ class StoreH5Decoration extends React.Component {
diskList, diskList,
visible, visible,
cutImageBlob, cutImageBlob,
hasImgReady hasImgReady,
imageFile,
} = this.state; } = this.state;
const DraggableContainer = (props) => ( const DraggableContainer = (props) => (
<SortableContainer <SortableContainer
...@@ -423,7 +433,7 @@ class StoreH5Decoration extends React.Component { ...@@ -423,7 +433,7 @@ class StoreH5Decoration extends React.Component {
}} }}
onSelect={this.handleSelectImg} onSelect={this.handleSelectImg}
/> />
<Modal {/* <Modal
title="设置图片" title="设置图片"
width={1080} width={1080}
visible={visible} visible={visible}
...@@ -481,7 +491,10 @@ class StoreH5Decoration extends React.Component { ...@@ -481,7 +491,10 @@ class StoreH5Decoration extends React.Component {
</div> </div>
</div> </div>
</div> </div>
</Modal> </Modal> */}
{ visible &&
<ImgClipModal visible={visible} imgUrl={imageFile.ossUrl} aspectRatio='500/172' cropBoxHeight='172' onConfirm={this.getSignature} onClose={()=>{this.setState({ visible: false });}}/>
}
</div> </div>
); );
} }
......
...@@ -4,10 +4,10 @@ import { Form, Input, Button, Checkbox ,Select,Modal,message} from 'antd'; ...@@ -4,10 +4,10 @@ import { Form, Input, Button, Checkbox ,Select,Modal,message} from 'antd';
import {industryList,childIndustryList} from '@/domains/store-domain/constants' import {industryList,childIndustryList} from '@/domains/store-domain/constants'
import SelectPrepareFileModal from '@/modules/prepare-lesson/modal/SelectPrepareFileModal'; import SelectPrepareFileModal from '@/modules/prepare-lesson/modal/SelectPrepareFileModal';
import Upload from '@/core/upload'; import Upload from '@/core/upload';
// import PhotoClip from 'photoclip';
import StoreService from "@/domains/store-domain/storeService"; import StoreService from "@/domains/store-domain/storeService";
import User from "@/common/js/user"; import User from "@/common/js/user";
import Bus from '@/core/tbus'; import Bus from '@/core/tbus';
import ImgClipModal from '@/components/ImgClipModal'
import "./StoreInfo.less"; import "./StoreInfo.less";
let cutFlag = false; let cutFlag = false;
class StoreInfo extends React.Component { class StoreInfo extends React.Component {
...@@ -23,6 +23,7 @@ class StoreInfo extends React.Component { ...@@ -23,6 +23,7 @@ class StoreInfo extends React.Component {
logo:'', logo:'',
showSelectFileModal:false, showSelectFileModal:false,
cutImageBlob: null, cutImageBlob: null,
imageFile: null, // 需要被截取的图片
} }
} }
componentWillMount(){ componentWillMount(){
...@@ -73,84 +74,88 @@ class StoreInfo extends React.Component { ...@@ -73,84 +74,88 @@ class StoreInfo extends React.Component {
}) })
} }
handleSelectCover = (file)=> { handleSelectCover = (file)=> {
this.uploadImage(file); // this.uploadImage(file);
this.setState({
visible: true,
imageFile:file
});
} }
//上传图片 //上传图片
uploadImage = (imageFile) => { // uploadImage = (imageFile) => {
const { folderName } = imageFile; // const { folderName } = imageFile;
const fileName = window.random_string(16) + folderName.slice(folderName.lastIndexOf(".")); // const fileName = window.random_string(16) + folderName.slice(folderName.lastIndexOf("."));
const self = this; // const self = this;
this.setState( // this.setState(
{ // {
visible: true, // visible: true,
}, // },
() => { // () => {
setTimeout(() => { // setTimeout(() => {
const okBtnDom = document.querySelector("#headPicModal"); // const okBtnDom = document.querySelector("#headPicModal");
const options = { // const options = {
size: [500, 128], // size: [500, 128],
ok: okBtnDom, // ok: okBtnDom,
maxZoom: 3, // maxZoom: 3,
style: { // style: {
jpgFillColor: "transparent", // jpgFillColor: "transparent",
}, // },
done: function (dataUrl) { // done: function (dataUrl) {
clearTimeout(self.timer); // clearTimeout(self.timer);
self.timer = setTimeout(() => { // self.timer = setTimeout(() => {
if ((self.state.rotate != this.rotate()) || (self.state.scale != this.scale())) { // if ((self.state.rotate != this.rotate()) || (self.state.scale != this.scale())) {
console.log(this.scale(), 'scale') // console.log(this.scale(), 'scale')
const _dataUrl = this.clip() // const _dataUrl = this.clip()
const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl); // const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl);
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl: _dataUrl, // dataUrl: _dataUrl,
rotate: this.rotate(), // rotate: this.rotate(),
scale: this.scale() // scale: this.scale()
}) // })
} // }
}, 500) // }, 500)
const cutImageBlob = self.convertBase64UrlToBlob(dataUrl); // const cutImageBlob = self.convertBase64UrlToBlob(dataUrl);
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl // dataUrl
}) // })
setTimeout(() => { // setTimeout(() => {
cutFlag = false; // cutFlag = false;
}, 2000); // }, 2000);
}, // },
fail: (failInfo) => { // fail: (failInfo) => {
message.error("图片上传失败了,请重新上传"); // message.error("图片上传失败了,请重新上传");
}, // },
loadComplete: function (img) { // loadComplete: function (img) {
setTimeout(() => { // setTimeout(() => {
const _dataUrl = this.clip() // const _dataUrl = this.clip()
self.setState({ // self.setState({
dataUrl: _dataUrl, // dataUrl: _dataUrl,
hasImgReady: true // hasImgReady: true
}) // })
}, 100) // }, 100)
}, // },
}; // };
const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}` // const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}`
if (!this.state.photoclip) { // if (!this.state.photoclip) {
const _photoclip = new PhotoClip("#headPicModal", options); // const _photoclip = new PhotoClip("#headPicModal", options);
_photoclip.load(imgUrl); // _photoclip.load(imgUrl);
this.setState({ // this.setState({
photoclip: _photoclip, // photoclip: _photoclip,
}); // });
} else { // } else {
this.state.photoclip.clear(); // this.state.photoclip.clear();
this.state.photoclip.load(imgUrl); // this.state.photoclip.load(imgUrl);
} // }
}, 200); // }, 200);
} // }
); // );
}; // };
//获取resourceId //获取resourceId
getSignature = (blob, fileName) => { getSignature = (blob, fileName) => {
...@@ -173,15 +178,15 @@ class StoreInfo extends React.Component { ...@@ -173,15 +178,15 @@ class StoreInfo extends React.Component {
}) })
} }
// base64转换成blob // base64转换成blob
convertBase64UrlToBlob = (urlData) => { // convertBase64UrlToBlob = (urlData) => {
const bytes = window.atob(urlData.split(",")[1]); // const bytes = window.atob(urlData.split(",")[1]);
const ab = new ArrayBuffer(bytes.length); // const ab = new ArrayBuffer(bytes.length);
const ia = new Uint8Array(ab); // const ia = new Uint8Array(ab);
for (let i = 0; i < bytes.length; i++) { // for (let i = 0; i < bytes.length; i++) {
ia[i] = bytes.charCodeAt(i); // ia[i] = bytes.charCodeAt(i);
} // }
return new Blob([ab], { type: "image/png" }); // return new Blob([ab], { type: "image/png" });
}; // };
updateInfo=()=>{ updateInfo=()=>{
const {storeName,storeFullName,logo,subjectType,corpIndustry,corpSubIndustry} = this.state; const {storeName,storeFullName,logo,subjectType,corpIndustry,corpSubIndustry} = this.state;
if(!storeName){ if(!storeName){
...@@ -216,7 +221,7 @@ class StoreInfo extends React.Component { ...@@ -216,7 +221,7 @@ class StoreInfo extends React.Component {
}); });
} }
render() { render() {
const {storeName,storeFullName,subjectType,corpIndustry,corpSubIndustry,showSelectFileModal,visible,hasImgReady,logo,cutImageBlob } = this.state; const {storeName,storeFullName,subjectType,corpIndustry,corpSubIndustry,showSelectFileModal,visible,hasImgReady,logo,cutImageBlob,imageFile} = this.state;
return ( return (
<div className="page store-info-page"> <div className="page store-info-page">
<div className="content-header">学院基本信息</div> <div className="content-header">学院基本信息</div>
...@@ -330,7 +335,7 @@ class StoreInfo extends React.Component { ...@@ -330,7 +335,7 @@ class StoreInfo extends React.Component {
onSelect={this.handleSelectCover} onSelect={this.handleSelectCover}
/> />
} }
<Modal {/* <Modal
title="设置图片" title="设置图片"
width={1080} width={1080}
visible={visible} visible={visible}
...@@ -388,7 +393,10 @@ class StoreInfo extends React.Component { ...@@ -388,7 +393,10 @@ class StoreInfo extends React.Component {
</div> </div>
</div> </div>
</div> </div>
</Modal> </Modal> */}
{ visible &&
<ImgClipModal visible={visible} imgUrl={imageFile.ossUrl} aspectRatio='125/32' cropBoxHeight='128' onConfirm={this.getSignature} onClose={()=>{this.setState({ visible: false });}}/>
}
<div><Button type="primary" onClick={this.updateInfo} htmlType="submit" className="submit-btn">更新信息</Button></div> <div><Button type="primary" onClick={this.updateInfo} htmlType="submit" className="submit-btn">更新信息</Button></div>
</div> </div>
......
/* /*
* @Author: wufan * @Author: wufan
* @Date: 2020-11-30 10:47:38 * @Date: 2020-11-30 10:47:38
* @LastEditors: wufan * @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-21 11:16:31 * @LastEditTime: 2021-07-01 15:38:32
* @Description: web学院banner页面 * @Description: web学院banner页面
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -25,6 +25,7 @@ import "./StoreDecorationPage.less"; ...@@ -25,6 +25,7 @@ import "./StoreDecorationPage.less";
import Upload from "@/core/upload"; import Upload from "@/core/upload";
import { XMTable } from '@/components'; import { XMTable } from '@/components';
import college from '@/common/lottie/college'; import college from '@/common/lottie/college';
import ImgClipModal from '@/components/ImgClipModal'
const { confirm } = Modal; const { confirm } = Modal;
const DragHandle = sortableHandle(() => ( const DragHandle = sortableHandle(() => (
...@@ -51,7 +52,8 @@ class StoreWebDecoration extends React.Component { ...@@ -51,7 +52,8 @@ class StoreWebDecoration extends React.Component {
photoclip: null, photoclip: null,
preview: "", preview: "",
cutImageBlob: null, cutImageBlob: null,
hasImgReady: false // 图片是否上传成功 hasImgReady: false,// 图片是否上传成功
imageFile: null // 需要被截取的图片
}; };
} }
...@@ -210,83 +212,90 @@ class StoreWebDecoration extends React.Component { ...@@ -210,83 +212,90 @@ class StoreWebDecoration extends React.Component {
this.setState({ this.setState({
showSelectFileModal: false, showSelectFileModal: false,
}); });
this.uploadImage(file); // this.uploadImage(file);
if(file){
this.setState({
visible: true,
imageFile:file
});
}
}; };
//上传图片 //上传图片
uploadImage = (imageFile) => { // uploadImage = (imageFile) => {
const self = this; // const self = this;
this.setState( // this.setState(
{ // {
visible: true, // visible: true,
}, // },
() => { // () => {
setTimeout(() => { // setTimeout(() => {
const okBtnDom = document.querySelector("#headPicModal"); // const okBtnDom = document.querySelector("#headPicModal");
const options = { // const options = {
size: [500, 73], // size: [500, 73],
ok: okBtnDom, // ok: okBtnDom,
maxZoom: 3, // maxZoom: 3,
style: { // style: {
jpgFillColor: "transparent", // jpgFillColor: "transparent",
}, // },
done: function (dataUrl) { // done: function (dataUrl) {
clearTimeout(self.timer); // clearTimeout(self.timer);
self.timer = setTimeout(() => { // self.timer = setTimeout(() => {
if ((self.state.rotate != this.rotate()) || (self.state.scale != this.scale())) { // if ((self.state.rotate != this.rotate()) || (self.state.scale != this.scale())) {
console.log(this.scale(), 'scale') // console.log(this.scale(), 'scale')
const _dataUrl = this.clip() // const _dataUrl = this.clip()
const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl); // const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl);
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl: _dataUrl, // dataUrl: _dataUrl,
rotate: this.rotate(), // rotate: this.rotate(),
scale: this.scale() // scale: this.scale()
}) // })
} // }
}, 500) // }, 500)
const cutImageBlob = self.convertBase64UrlToBlob(dataUrl); // const cutImageBlob = self.convertBase64UrlToBlob(dataUrl);
self.setState({ // self.setState({
cutImageBlob, // cutImageBlob,
dataUrl // dataUrl
}) // })
setTimeout(() => { // setTimeout(() => {
cutFlag = false; // cutFlag = false;
}, 2000); // }, 2000);
}, // },
fail: (failInfo) => { // fail: (failInfo) => {
message.error("图片上传失败了,请重新上传"); // message.error("图片上传失败了,请重新上传");
}, // },
loadComplete: function (img) { // loadComplete: function (img) {
setTimeout(() => { // setTimeout(() => {
const _dataUrl = this.clip() // const _dataUrl = this.clip()
self.setState({ // self.setState({
dataUrl: _dataUrl, // dataUrl: _dataUrl,
hasImgReady: true // hasImgReady: true
}) // })
}, 100) // }, 100)
}, // },
}; // };
const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}` // const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}`
if (!this.state.photoclip) { // if (!this.state.photoclip) {
const _photoclip = new PhotoClip("#headPicModal", options); // const _photoclip = new PhotoClip("#headPicModal", options);
_photoclip.load(imgUrl); // _photoclip.load(imgUrl);
this.setState({ // this.setState({
photoclip: _photoclip, // photoclip: _photoclip,
}); // });
} else { // } else {
this.state.photoclip.clear(); // this.state.photoclip.clear();
this.state.photoclip.load(imgUrl); // this.state.photoclip.load(imgUrl);
} // }
}, 200); // }, 200);
} // }
); // );
}; // };
//获取resourceId //获取resourceId
getSignature = (blob) => { getSignature = (blob) => {
...@@ -343,15 +352,15 @@ class StoreWebDecoration extends React.Component { ...@@ -343,15 +352,15 @@ class StoreWebDecoration extends React.Component {
}; };
// base64转换成blob // base64转换成blob
convertBase64UrlToBlob = (urlData) => { // convertBase64UrlToBlob = (urlData) => {
const bytes = window.atob(urlData.split(",")[1]); // const bytes = window.atob(urlData.split(",")[1]);
const ab = new ArrayBuffer(bytes.length); // const ab = new ArrayBuffer(bytes.length);
const ia = new Uint8Array(ab); // const ia = new Uint8Array(ab);
for (let i = 0; i < bytes.length; i++) { // for (let i = 0; i < bytes.length; i++) {
ia[i] = bytes.charCodeAt(i); // ia[i] = bytes.charCodeAt(i);
} // }
return new Blob([ab], { type: "image/png" }); // return new Blob([ab], { type: "image/png" });
}; // };
render() { render() {
const { const {
...@@ -360,7 +369,8 @@ class StoreWebDecoration extends React.Component { ...@@ -360,7 +369,8 @@ class StoreWebDecoration extends React.Component {
diskList, diskList,
visible, visible,
cutImageBlob, cutImageBlob,
hasImgReady hasImgReady,
imageFile
} = this.state; } = this.state;
const DraggableContainer = (props) => ( const DraggableContainer = (props) => (
<SortableContainer <SortableContainer
...@@ -421,7 +431,7 @@ class StoreWebDecoration extends React.Component { ...@@ -421,7 +431,7 @@ class StoreWebDecoration extends React.Component {
}} }}
onSelect={this.handleSelectImg} onSelect={this.handleSelectImg}
/> />
<Modal {/* <Modal
title="设置图片" title="设置图片"
width={1080} width={1080}
visible={visible} visible={visible}
...@@ -479,7 +489,10 @@ class StoreWebDecoration extends React.Component { ...@@ -479,7 +489,10 @@ class StoreWebDecoration extends React.Component {
</div> </div>
</div> </div>
</div> </div>
</Modal> </Modal> */}
{ visible &&
<ImgClipModal visible={visible} imgUrl={imageFile.ossUrl} aspectRatio='500/73' cropBoxHeight='73' onConfirm={this.getSignature} onClose={()=>{this.setState({ visible: false });}}/>
}
</div> </div>
); );
} }
......
...@@ -11,6 +11,8 @@ import { XMContext } from '@/store/context'; ...@@ -11,6 +11,8 @@ import { XMContext } from '@/store/context';
import ExamShareModal from './ExamShareModal'; import ExamShareModal from './ExamShareModal';
import DataAnalysic from './DataAnalysic'; import DataAnalysic from './DataAnalysic';
import PreviewModal from './PreviewModal'; import PreviewModal from './PreviewModal';
import college from '@/common/lottie/college.json';
import './index.less'; import './index.less';
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
const { Search } = Input; const { Search } = Input;
...@@ -425,6 +427,7 @@ function ExaminationManager(props: any) { ...@@ -425,6 +427,7 @@ function ExaminationManager(props: any) {
pagination={false} pagination={false}
style={{ margin: '0px 0 16px' }} style={{ margin: '0px 0 16px' }}
renderEmpty={{ renderEmpty={{
image: college,
description: <span style={{ display: 'block', paddingBottom: 24 }}>暂无数据</span>, description: <span style={{ display: 'block', paddingBottom: 24 }}>暂无数据</span>,
}}></XMTable> }}></XMTable>
{total > 0 && ( {total > 0 && (
......
...@@ -584,8 +584,13 @@ class OperatePaper extends Component { ...@@ -584,8 +584,13 @@ class OperatePaper extends Component {
min={1} min={1}
max={100} max={100}
value={record.score || 2} value={record.score || 2}
formatter={value => parseInt(value)}
parser={value => parseInt(value)}
onChange={(value) => { onChange={(value) => {
value = Math.round(value); value = Math.round(value)
if (value <= record.portionScore) {
return
}
const _selectQuestionList = [...selectQuestionList]; const _selectQuestionList = [...selectQuestionList];
this.setState( this.setState(
{ {
...@@ -609,7 +614,9 @@ class OperatePaper extends Component { ...@@ -609,7 +614,9 @@ class OperatePaper extends Component {
{record.questionType === 'GAP_FILLING' ? <span>半对得</span> : <span>漏选得</span>}{' '} {record.questionType === 'GAP_FILLING' ? <span>半对得</span> : <span>漏选得</span>}{' '}
<InputNumber <InputNumber
min={0} min={0}
max={record.score - 1} max={ record.score <= 0 ? 0 : record.score - 1}
formatter={value => parseInt(value)}
parser={value => parseInt(value)}
value={record.portionScore || 0} value={record.portionScore || 0}
onChange={(value) => { onChange={(value) => {
value = Math.round(value); value = Math.round(value);
...@@ -919,16 +926,20 @@ class OperatePaper extends Component { ...@@ -919,16 +926,20 @@ class OperatePaper extends Component {
<div className='paper-info-tip' style={{ margin: '0 auto 12px' }}> <div className='paper-info-tip' style={{ margin: '0 auto 12px' }}>
总计<span>{totalScore}</span>分,共 总计<span>{totalScore}</span>分,共
<span>{questionCnt}</span> <span>{questionCnt}</span>
题。 {singleChoiceCnt > 0 && `单选题${singleChoiceCnt}题,共${singleChoiceScore}分;`} 题。{" "}
{multiChoiceCnt > 0 && `多选题${multiChoiceCnt}题,共${multiChoiceScore}分;`} {singleChoiceCnt > 0 &&
{judgeCnt > 0 && `判断题${judgeCnt}题,共${judgeScore}分,`} `单选题${singleChoiceCnt}题,共${singleChoiceScore}分;`}
{gapFillingCnt > 0 && `填空题${gapFillingCnt}题,共${gapFillingScore}分,`} {multiChoiceCnt > 0 &&
{indefiniteChoiceCnt > 0 && `不定项选择题${indefiniteChoiceCnt}题,共${indefiniteChoiceScore}分`} `多选题${multiChoiceCnt}题,共${multiChoiceScore}分;`}
{judgeCnt > 0 && `判断题${judgeCnt}题,共${judgeScore}分;`}
{gapFillingCnt > 0 &&
`填空题${gapFillingCnt}题,共${gapFillingScore}分;`}
{indefiniteChoiceCnt > 0 &&
`不定项选择题${indefiniteChoiceCnt}题,共${indefiniteChoiceScore}分;`}
</div> </div>
)} )}
<XMTable <XMTable
className='table-style' className='table-style'
scroll={{ y: 350 }}
columns={this.parseColumns()} columns={this.parseColumns()}
dataSource={selectQuestionList} dataSource={selectQuestionList}
pagination={false} pagination={false}
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
.table-style { .table-style {
border: 1px solid #f0f0f0 !important; border: 1px solid #f0f0f0 !important;
margin-bottom: 70px; margin-bottom: 70px;
max-height: calc(~'100vh - 465px');
overflow: scroll;
} }
.ant-tabs { .ant-tabs {
color: #666666; color: #666666;
......
import React, { useEffect, useState} from "react"; import React, { useEffect, useState} from "react";
import { Modal, Button, InputNumber } from 'antd'; import { Modal, Button, InputNumber, message } from 'antd';
import "./BatchScore.less" import "./BatchScore.less"
import _ from "underscore"; import _ from "underscore";
...@@ -56,6 +56,12 @@ export default function BatchScore(props:BatchScoreProps) { ...@@ -56,6 +56,12 @@ export default function BatchScore(props:BatchScoreProps) {
} }
function onOk() { function onOk() {
for (let i = 0;i < rules.length;++i) {
if (rules[i].score <= 0 || rules[i].score > 100) {
message.error("分值设置错误")
return;
}
}
props.onOK(rules) props.onOK(rules)
} }
...@@ -84,6 +90,8 @@ export default function BatchScore(props:BatchScoreProps) { ...@@ -84,6 +90,8 @@ export default function BatchScore(props:BatchScoreProps) {
value={rules[4].score} value={rules[4].score}
defaultValue={rules[4].score} defaultValue={rules[4].score}
style={inputNumberStyle} style={inputNumberStyle}
formatter={(value:number|undefined) => String(value)}
parser={(value:string|undefined) => parseInt(String(value))}
onChange={(v)=> { onChange={(v)=> {
v = Math.round(v) v = Math.round(v)
let _rules = [...rules] let _rules = [...rules]
...@@ -103,8 +111,13 @@ export default function BatchScore(props:BatchScoreProps) { ...@@ -103,8 +111,13 @@ export default function BatchScore(props:BatchScoreProps) {
defaultValue={rules[3].score} defaultValue={rules[3].score}
value={rules[3].score} value={rules[3].score}
style={inputNumberStyle} style={inputNumberStyle}
formatter={(value:number|undefined) => String(value)}
parser={(value:string|undefined) => parseInt(String(value))}
onChange={(v)=> { onChange={(v)=> {
v = Math.round(v) v = Math.round(v)
if (v <= rules[3].portionScore) {
return
}
let _r = [...rules] let _r = [...rules]
_r[3].score = v _r[3].score = v
setRules(_r) setRules(_r)
...@@ -113,10 +126,12 @@ export default function BatchScore(props:BatchScoreProps) { ...@@ -113,10 +126,12 @@ export default function BatchScore(props:BatchScoreProps) {
分,漏选得 分,漏选得
<InputNumber <InputNumber
min={0} min={0}
max={rules[3].score-1} max={rules[3].score <= 0 ? 0 : rules[3].score-1}
defaultValue={rules[3].portionScore} defaultValue={rules[3].portionScore}
value={rules[3].portionScore} value={rules[3].portionScore}
style={inputNumberStyle} style={inputNumberStyle}
formatter={(value:number|undefined) => String(value)}
parser={(value:string|undefined) => parseInt(String(value))}
onChange={(v)=> { onChange={(v)=> {
v = Math.round(v) v = Math.round(v)
let _r = [...rules] let _r = [...rules]
...@@ -136,8 +151,13 @@ export default function BatchScore(props:BatchScoreProps) { ...@@ -136,8 +151,13 @@ export default function BatchScore(props:BatchScoreProps) {
defaultValue={rules[1].score} defaultValue={rules[1].score}
value={rules[1].score} value={rules[1].score}
style={inputNumberStyle} style={inputNumberStyle}
formatter={(value:number|undefined) => String(value)}
parser={(value:string|undefined) => parseInt(String(value))}
onChange={(v)=> { onChange={(v)=> {
v = Math.round(v) v = Math.round(v)
if (v <= rules[1].portionScore) {
return
}
let _r = [...rules] let _r = [...rules]
_r[1].score = v _r[1].score = v
setRules(_r) setRules(_r)
...@@ -146,10 +166,12 @@ export default function BatchScore(props:BatchScoreProps) { ...@@ -146,10 +166,12 @@ export default function BatchScore(props:BatchScoreProps) {
分,漏选得 分,漏选得
<InputNumber <InputNumber
min={0} min={0}
max={rules[1].score-1} max={rules[1].score <= 0 ? 0 : rules[1].score-1}
defaultValue={rules[1].portionScore} defaultValue={rules[1].portionScore}
value={rules[1].portionScore} value={rules[1].portionScore}
style={inputNumberStyle} style={inputNumberStyle}
formatter={(value:number|undefined) => String(value)}
parser={(value:string|undefined) => parseInt(String(value))}
onChange={(v)=> { onChange={(v)=> {
v = Math.round(v) v = Math.round(v)
let _r = [...rules] let _r = [...rules]
...@@ -168,6 +190,8 @@ export default function BatchScore(props:BatchScoreProps) { ...@@ -168,6 +190,8 @@ export default function BatchScore(props:BatchScoreProps) {
defaultValue={rules[2].score} defaultValue={rules[2].score}
value={rules[2].score} value={rules[2].score}
style={inputNumberStyle} style={inputNumberStyle}
formatter={(value:number|undefined) => String(value)}
parser={(value:string|undefined) => parseInt(String(value))}
onChange={(v)=> { onChange={(v)=> {
v = Math.round(v) v = Math.round(v)
let _r = [...rules] let _r = [...rules]
...@@ -187,8 +211,13 @@ export default function BatchScore(props:BatchScoreProps) { ...@@ -187,8 +211,13 @@ export default function BatchScore(props:BatchScoreProps) {
defaultValue={rules[0].score} defaultValue={rules[0].score}
value={rules[0].score} value={rules[0].score}
style={inputNumberStyle} style={inputNumberStyle}
formatter={(value:number|undefined) => String(value)}
parser={(value:string|undefined) => parseInt(String(value))}
onChange={(v)=> { onChange={(v)=> {
v = Math.round(v) v = Math.round(v)
if (v <= rules[0].portionScore) {
return
}
let _r = [...rules] let _r = [...rules]
_r[0].score = v _r[0].score = v
setRules(_r) setRules(_r)
...@@ -196,10 +225,12 @@ export default function BatchScore(props:BatchScoreProps) { ...@@ -196,10 +225,12 @@ export default function BatchScore(props:BatchScoreProps) {
/> />
分,半对得<InputNumber 分,半对得<InputNumber
min={0} min={0}
max={rules[0].score-1} max={rules[0].score <= 0 ? 0 : rules[0].score-1}
defaultValue={rules[0].portionScore} defaultValue={rules[0].portionScore}
value={rules[0].portionScore} value={rules[0].portionScore}
style={inputNumberStyle} style={inputNumberStyle}
formatter={(value:number|undefined) => String(value)}
parser={(value:string|undefined) => parseInt(String(value))}
onChange={(v)=> { onChange={(v)=> {
v = Math.round(v) v = Math.round(v)
let _r = [...rules] let _r = [...rules]
......
...@@ -31,6 +31,8 @@ import _ from "underscore"; ...@@ -31,6 +31,8 @@ import _ from "underscore";
import PaperPreviewModal from "../modal/PreviewPaperModal"; import PaperPreviewModal from "../modal/PreviewPaperModal";
import MoveModal from '../../modal/MoveModal'; import MoveModal from '../../modal/MoveModal';
import Bus from "@/core/bus"; import Bus from "@/core/bus";
import college from '@/common/lottie/college';
const { Search } = Input; const { Search } = Input;
...@@ -625,6 +627,7 @@ class PaperList extends Component { ...@@ -625,6 +627,7 @@ class PaperList extends Component {
bordered bordered
loading={loading} loading={loading}
renderEmpty={{ renderEmpty={{
image: college,
description: <span style={{ display: 'block', paddingBottom: 24 }}>还没有试卷</span> description: <span style={{ display: 'block', paddingBottom: 24 }}>还没有试卷</span>
}} }}
/> />
...@@ -641,6 +644,7 @@ class PaperList extends Component { ...@@ -641,6 +644,7 @@ class PaperList extends Component {
pagination={false} pagination={false}
bordered bordered
renderEmpty={{ renderEmpty={{
image: college,
description: <span style={{ display: 'block', paddingBottom: 24 }}>还没有试卷</span> description: <span style={{ display: 'block', paddingBottom: 24 }}>还没有试卷</span>
}} }}
/> />
......
...@@ -25,6 +25,8 @@ import AidToolService from "@/domains/aid-tool-domain/AidToolService"; ...@@ -25,6 +25,8 @@ import AidToolService from "@/domains/aid-tool-domain/AidToolService";
import _ from "underscore"; import _ from "underscore";
import Bus from "@/core/bus"; import Bus from "@/core/bus";
import moment from 'moment'; import moment from 'moment';
import { XMTable } from '@/components';
import college from '@/common/lottie/college';
const { Search } = Input; const { Search } = Input;
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
...@@ -201,19 +203,6 @@ class SelectQuestionList extends Component { ...@@ -201,19 +203,6 @@ class SelectQuestionList extends Component {
return columns; return columns;
}; };
// 自定义表格空状态
customizeRenderEmpty = () => {
return (
<Empty
image="https://image.xiaomaiketang.com/xm/emptyTable.png"
imageStyle={{
height: 100,
}}
description={"还没有题目"}
></Empty>
);
};
onShowSizeChange = (current, size) => { onShowSizeChange = (current, size) => {
if (current == size) { if (current == size) {
return; return;
...@@ -431,8 +420,11 @@ class SelectQuestionList extends Component { ...@@ -431,8 +420,11 @@ class SelectQuestionList extends Component {
)} )}
</div> </div>
<div className="select-question-content"> <div className="select-question-content">
<ConfigProvider renderEmpty={this.customizeRenderEmpty}> <XMTable
<Table renderEmpty={{
image: college,
description: '还没有题目'
}}
rowSelection={rowSelection} rowSelection={rowSelection}
rowKey={(record) => record.id} rowKey={(record) => record.id}
dataSource={dataSource} dataSource={dataSource}
...@@ -441,7 +433,6 @@ class SelectQuestionList extends Component { ...@@ -441,7 +433,6 @@ class SelectQuestionList extends Component {
onChange={this.handleChangeTable} onChange={this.handleChangeTable}
bordered bordered
/> />
</ConfigProvider>
<div className="box-footer"> <div className="box-footer">
<PageControl <PageControl
current={current - 1} current={current - 1}
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Table, ConfigProvider, Empty, Row, Input, Select, Tooltip, Space, Button, Modal, message, Menu, Dropdown, DatePicker } from 'antd'; import { Row, Input, Select, Tooltip, Space, Button, Modal, message, Menu, Dropdown, DatePicker } from 'antd';
import _ from 'underscore'; import _ from 'underscore';
import { Route, withRouter } from 'react-router-dom'; import { Route, withRouter } from 'react-router-dom';
import { DownOutlined } from '@ant-design/icons'; import { DownOutlined } from '@ant-design/icons';
...@@ -21,6 +21,8 @@ import Bus from '@/core/bus'; ...@@ -21,6 +21,8 @@ import Bus from '@/core/bus';
import moment from 'moment'; import moment from 'moment';
import Service from '@/common/js/service'; import Service from '@/common/js/service';
import MoveModal from '../../modal/MoveModal'; import MoveModal from '../../modal/MoveModal';
import college from '@/common/lottie/college';
import './QuestionList.less'; import './QuestionList.less';
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
...@@ -671,6 +673,7 @@ class QuestionList extends Component { ...@@ -671,6 +673,7 @@ class QuestionList extends Component {
onChange={this.handleChangeTable} onChange={this.handleChangeTable}
rowSelection={rowSelection} rowSelection={rowSelection}
renderEmpty={{ renderEmpty={{
image: college,
description: ( description: (
<span style={{ display: 'block', paddingBottom: 24 }}> <span style={{ display: 'block', paddingBottom: 24 }}>
<span>还没有题目</span> <span>还没有题目</span>
......
...@@ -6376,7 +6376,6 @@ hmac-drbg@^1.0.0: ...@@ -6376,7 +6376,6 @@ hmac-drbg@^1.0.0:
minimalistic-assert "^1.0.0" minimalistic-assert "^1.0.0"
minimalistic-crypto-utils "^1.0.1" minimalistic-crypto-utils "^1.0.1"
hoist-non-react-statics@^3.1.0: hoist-non-react-statics@^3.1.0:
version "3.3.2" version "3.3.2"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
...@@ -8446,14 +8445,6 @@ mini-css-extract-plugin@0.9.0: ...@@ -8446,14 +8445,6 @@ mini-css-extract-plugin@0.9.0:
schema-utils "^1.0.0" schema-utils "^1.0.0"
webpack-sources "^1.1.0" webpack-sources "^1.1.0"
mini-store@^3.0.1:
version "3.0.6"
resolved "https://registry.yarnpkg.com/mini-store/-/mini-store-3.0.6.tgz#44b86be5b2877271224ce0689b3a35a2dffb1ca9"
integrity sha512-YzffKHbYsMQGUWQRKdsearR79QsMzzJcDDmZKlJBqt5JNkqpyJHYlK6gP61O36X+sLf76sO9G6mhKBe83gIZIQ==
dependencies:
hoist-non-react-statics "^3.3.2"
shallowequal "^1.0.2"
minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7"
...@@ -10787,7 +10778,6 @@ rc-table@~7.15.1: ...@@ -10787,7 +10778,6 @@ rc-table@~7.15.1:
"@babel/runtime" "^7.10.1" "@babel/runtime" "^7.10.1"
classnames "^2.2.5" classnames "^2.2.5"
rc-resize-observer "^1.0.0" rc-resize-observer "^1.0.0"
rc-util "^5.13.0" rc-util "^5.13.0"
shallowequal "^1.1.0" shallowequal "^1.1.0"
......
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