dev_unstable
hjm 6 years ago
parent c10ef72b2e
commit 35a071722f

@ -314,6 +314,7 @@ export function TPMIndexHOC(WrappedComponent) {
}) })
} }
showProfileCompleteDialog = () => { showProfileCompleteDialog = () => {
this.dialogObj = {}
this.setState({ this.setState({
AccountProfiletype: true AccountProfiletype: true
}) })
@ -321,6 +322,20 @@ export function TPMIndexHOC(WrappedComponent) {
checkIfProfileCompleted = () => { checkIfProfileCompleted = () => {
return this.state.current_user && this.state.current_user.profile_completed return this.state.current_user && this.state.current_user.profile_completed
} }
showProfessionalCertificationDialog = () => {
this.dialogObj = {
content: '您需要去完成您的职业认证,才能使用此功能',
okText: '立即完成',
okHref: '/account/certification'
}
this.setState({
AccountProfiletype: true,
})
}
checkIfProfessionalCertification = () => {
return this.state.current_user && this.state.current_user.professional_certification
}
ShowOnlinePdf = (url) => { ShowOnlinePdf = (url) => {
return axios({ return axios({
@ -358,10 +373,14 @@ export function TPMIndexHOC(WrappedComponent) {
isNotMember: this.isNotMember, isNotMember: this.isNotMember,
isUserid:this.state.coursedata&&this.state.coursedata.userid, isUserid:this.state.coursedata&&this.state.coursedata.userid,
fetchUser: this.fetchUser, fetchUser: this.fetchUser,
showLoginDialog: this.showLoginDialog, showLoginDialog: this.showLoginDialog,
checkIfLogin: this.checkIfLogin, checkIfLogin: this.checkIfLogin,
showProfileCompleteDialog: this.showProfileCompleteDialog, showProfileCompleteDialog: this.showProfileCompleteDialog,
checkIfProfileCompleted: this.checkIfProfileCompleted, checkIfProfileCompleted: this.checkIfProfileCompleted,
checkIfProfessionalCertification: this.checkIfProfessionalCertification,
showProfessionalCertificationDialog: this.showProfessionalCertificationDialog,
ShowOnlinePdf:(url)=>this.ShowOnlinePdf(url), ShowOnlinePdf:(url)=>this.ShowOnlinePdf(url),
DownloadFileA:(title,url)=>this.DownloadFileA(title,url), DownloadFileA:(title,url)=>this.DownloadFileA(title,url),
} }
@ -372,10 +391,12 @@ export function TPMIndexHOC(WrappedComponent) {
{...this.props} {...this.props}
{...this.state} {...this.state}
/> : ""} /> : ""}
{/* AccountProfile 也用作职业认证 */}
{AccountProfiletype===true ? <AccountProfile {AccountProfiletype===true ? <AccountProfile
hideAccountProfile={()=>this.hideAccountProfile()} hideAccountProfile={()=>this.hideAccountProfile()}
{...this.props} {...this.props}
{...this.state} {...this.state}
{...this.dialogObj}
/>:""} />:""}
<SiderBar Headertop={Headertop}/> <SiderBar Headertop={Headertop}/>
{/* 注释掉了1440 影响到了手机屏幕的展示 */} {/* 注释掉了1440 影响到了手机屏幕的展示 */}

@ -46,8 +46,13 @@ class AccountProfile extends Component {
} }
/**
content: '您需要去完成您的职业认证,才能使用此功能',
okText: '立即完成',
okHref: '/account/certification'
*/
render() { render() {
const { content, okText, okHref } = this.props;
return( return(
<Modal <Modal
keyboard={false} keyboard={false}
@ -60,10 +65,10 @@ render() {
width="530px" width="530px"
> >
<div className="task-popup-content"> <div className="task-popup-content">
<p className="task-popup-text-center font-16">您需要去完善您的个人资料才能使用此功能</p> <p className="task-popup-text-center font-16"> {content || '您需要去完善您的个人资料,才能使用此功能'}</p>
<div className="clearfix mt30 edu-txt-center"> <div className="clearfix mt30 edu-txt-center">
<a className="task-btn mr30" onClick={()=>this.gotoback()}>取消</a> <a className="task-btn mr30" onClick={()=>this.gotoback()}>取消</a>
<a className="task-btn task-btn-orange" href={"/account/profile/edit"}>立即完善</a> <a className="task-btn task-btn-orange" href={ okHref || "/account/profile/edit" }> {okText || '立即完善'}</a>
</div> </div>
</div> </div>
</Modal> </Modal>

@ -69,7 +69,12 @@ function InfoVideo (props) {
const username = props.match.params.username const username = props.match.params.username
function toUpload() { function toUpload() {
if (props.current_user.admin || (props.current_user.is_teacher && props.checkIfProfessionalCertification())) {
history.push(`/users/${username}/videoes/upload`) history.push(`/users/${username}/videoes/upload`)
} else {
props.showProfessionalCertificationDialog()
}
} }
function fetchVideoes() { function fetchVideoes() {
const fetchUrl = `/users/${username}/videos.json` const fetchUrl = `/users/${username}/videos.json`

Loading…
Cancel
Save