Merge pull request '工程认证弹框等特殊定制' (#247) from caishi/forgeplus-react:dev_educoder into dev_educoder

This commit is contained in:
jasder 2021-11-08 14:29:33 +08:00
commit 01dff209d4
6 changed files with 83 additions and 12 deletions

View File

@ -24,6 +24,18 @@ export function getImageUrl(path) {
return `${path}`;
}
export function openNewWindow(url) {
let link = document.createElement('a')
link.target = "_blank"
document.body.appendChild(link)
link.href = url
let evt = document.createEvent("MouseEvents")
evt.initEvent("click", false, false)
link.dispatchEvent(evt)
document.body.removeChild(link);
}
export function numFormat(num, digits){
let d = digits || 1;
var si = [

View File

@ -7,6 +7,7 @@ export {
getImageUrl as getImageUrl,getImage as getImage, getmyUrl as getmyUrl, getRandomNumber as getRandomNumber, getUrl as getUrl, publicSearchs as publicSearchs, getRandomcode as getRandomcode, getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl
, getUploadActionUrl as getUploadActionUrl, getUploadActionUrltwo as getUploadActionUrltwo, getUploadActionUrlthree as getUploadActionUrlthree, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth
, getTaskUrlById as getTaskUrlById, TEST_HOST, htmlEncode as htmlEncode, getupload_git_file as getupload_git_file, getcdnImageUrl as getcdnImageUrl
, openNewWindow as openNewWindow
} from './UrlTool';
export { setmiyah as setmiyah } from './Component';

View File

@ -0,0 +1,30 @@
import React from 'react';
import { Modal } from 'antd';
import { openNewWindow } from 'educoder';
function Engineer({QQVisible,setQQVisible}) {
return(
<Modal
centered
destroyOnClose={true}
visible={QQVisible}
title="提示"
width="500px"
// footer={null}ee
okText="立即联系"
cancelText="取消"
onOk={() => {
openNewWindow("https://qm.qq.com/cgi-bin/qm/qr?k=DWdqQHAbbfw7_rqm0d-Q_vDn5H6bMp91&jump_from=webapi")
}}
onCancel={() => setQQVisible(false)}
>
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
<p>您可以在QQ服务群向管理员申请获得继续操作的权限</p >
< img src={require("./teacherQQ.png")} width={200} height={200} alt=""/>
<p>群号693542422 </p >
</div>
</Modal >
)
}
export default Engineer

View File

@ -1,9 +1,8 @@
import React, { Component } from 'react';
import AccountProfile from "../../modules/user/AccountProfile";
import { getImageUrl } from 'educoder'
import { getImageUrl , openNewWindow } from 'educoder';
import axios from 'axios';
import { Input , notification , Dropdown ,Popover, Menu,Badge, Button } from 'antd';
import { Link } from 'react-router-dom';
import { Input , notification , Dropdown , Menu } from 'antd';
import LoginDialog from '../../modules/login/LoginDialog';
import HeadSearch from '../Component/HeadSearch';
@ -13,13 +12,14 @@ import '../../modules/tpm/TPMIndex.css';
import CheckProfile from '../Component/ProfileModal/Profile';
import './header.scss';
import NoticeContent from './NoticeContent';
import Engineer from './Engineer';
const $ = window.$
// TODO 这部分脚本从公共脚本中直接调用
const { Search } = Input;
let old_url;
window._header_componentHandler = null;
const isPath= window.location.hostname ==='code.educoder.net' || window.location.hostname==='testforgeplus.educoder.net';
// 非trustie链接则新开页跳转
const str = ['www.trustie.net','forgeplus.trustie.net','forum.trustie.net','testforgeplus.trustie.net']
class NewHeader extends Component {
@ -49,6 +49,7 @@ class NewHeader extends Component {
visiblemyss: false,
openSearch:false,
visible:false, //浮动消息框展示控制
QQVisible:false
}
}
componentDidMount() {
@ -346,14 +347,32 @@ class NewHeader extends Component {
this.setState({ visible });
};
turntoEngineer=(url)=>{
const { current_user } = this.props;
if(current_user && current_user.login){
if(url){
window.location.href=url;
}else{
this.setState({
QQVisible:true
})
}
}else{
this.educoderlogin();
}
}
setQQVisible=()=>{
this.setState({
QQVisible:false
})
}
render() {
const { match ,resetUserInfo ,showNotification} = this.props;
const { match } = this.props;
let current_user = this.props.user;
let { Addcoursestypes,
tojoinitemtype,
tojoinclasstitle,
code_notice,
checked_notice,
let {
QQVisible,
AccountProfiletype,
user,
isRender,
@ -441,6 +460,7 @@ class NewHeader extends Component {
let search_url = settings && settings.common && settings.common.search;
return (
<div className="newHeaders" id="nHeader">
<Engineer QQVisible={QQVisible} setQQVisible={this.setQQVisible}/>
<div className="headerContent">
{isRender === true ?
<LoginDialog
@ -490,12 +510,19 @@ class NewHeader extends Component {
var waiLian = (new_link && str.filter(item=>new_link.indexOf(item)>-1) );
var wl = waiLian && waiLian.length>0;
return (
<li key={key} onClick={() => this.headtypesonClick(item.link, true)} className={`${this.matchpaths(item.link) === true ? 'pr active' : 'pr'}`} style={!is_hidden ? { display: 'flex' } : { display: 'none' }}>
<li key={key} onClick={() => this.headtypesonClick(item.link, true)} className={`${((isPath && item.name === "大学开源") || this.matchpaths(item.link) === true) ? 'pr active' : 'pr'}`} style={!is_hidden ? { display: 'flex' } : { display: 'none' }}>
<a href={new_link} target={wl ? "_self":"_blank"}><div dangerouslySetInnerHTML={{ __html: item.name }}></div></a>
</li>
)
})
}
{
settings && settings.engineer_url !== undefined ?
<li>
<a onClick={()=>this.turntoEngineer(settings.engineer_url)}>工程认证</a>
</li>
:""
}
</ul>
: ""
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -121,8 +121,9 @@
justify-content: space-between;
flex-wrap: wrap;
align-items: center;
padding:25px 30px;
padding:0px 30px;
border-bottom: 1px solid #E0E0E0;
height: 62px;
}
.list-r-Search{
width: 400px;