This commit is contained in:
caishi 2021-11-05 18:17:27 +08:00 committed by caishi
parent 5e64ce0d40
commit f75b4b73da
6 changed files with 81 additions and 8 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,7 +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,
turnbar,returnbar
turnbar,returnbar, 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,6 +1,6 @@
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 cookie from 'react-cookies';
import { notification , Dropdown ,Popover, Menu,Badge, Input } from 'antd';
@ -16,6 +16,8 @@ import CheckProfile from '../Component/ProfileModal/Profile';
import './header.scss';
import NoticeContent from './NoticeContent';
import MainLogo from './img/logo.png';
import Engineer from './Engineer';
const $ = window.$
// TODO 这部分脚本从公共脚本中直接调用
const { Search } = Input;
window._header_componentHandler = null;
@ -48,6 +50,7 @@ class NewHeader extends Component {
visiblemyss: false,
openSearch:false,
visible:false, //浮动消息框展示控制
QQVisible:false
}
}
componentDidMount() {
@ -336,14 +339,33 @@ 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 { resetUserInfo ,showNotification,publicNav} = 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,
@ -353,6 +375,7 @@ class NewHeader extends Component {
let search_url = settings && settings.common && settings.common.search;
return (
<div className={publicNav ? `newHeaders publicNav`:`newHeaders`} id="nHeader">
<Engineer QQVisible={QQVisible} setQQVisible={this.setQQVisible}/>
<div className="headerContent">
{isRender === true ?
<LoginDialog
@ -415,6 +438,13 @@ class NewHeader extends Component {
)
})
}
{
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;