From 0f09a0e8b0cf534800ee8625e7cb3458ca700035 Mon Sep 17 00:00:00 2001 From: qiukai <123456@qq.com> Date: Wed, 27 Nov 2024 14:27:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B6=E4=BD=99=E9=A6=96=E9=A1=B5=E5=9F=8B?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Information/Pages/JCC/homePage.jsx | 13 ++++++++ src/forge/Information/Pages/headerPage.jsx | 14 ++++++++- .../Information/Pages/headerPageZone1.jsx | 15 ++++++++- .../Information/Pages/headerPagebyCCF.jsx | 14 +++++++++ src/forge/Information/utils.js | 31 +++++++++++-------- 5 files changed, 72 insertions(+), 15 deletions(-) diff --git a/src/forge/Information/Pages/JCC/homePage.jsx b/src/forge/Information/Pages/JCC/homePage.jsx index 8faf02091..ad040ec86 100644 --- a/src/forge/Information/Pages/JCC/homePage.jsx +++ b/src/forge/Information/Pages/JCC/homePage.jsx @@ -15,6 +15,8 @@ import PartnerJcc from './Component/partnerJcc'; import '../../indexZone1.scss' import './index.scss' import { Popover, Tabs } from 'antd'; +import {getUniqueIdentifier,getUserName,getBrowserPlatform,getBrowserBrand} from '../../utils' +import {setZoneVisits} from '../../api' let tabTimer = undefined; @@ -33,6 +35,17 @@ function HeaderPageJCC(props){ {imageUrl: visionZy, title: '资源易共享'}, {imageUrl: visionJz, title: '价值可交换'} ] + + useEffect(()=>{ + let uuid = getUniqueIdentifier() + let url = props.location.pathname + let platform = getBrowserPlatform() + let browser = getBrowserBrand() + let username = getUserName(props.current_user) + // if(!username) uuid = getUniqueIdentifier() + let remark = ` 操作系统:${platform};浏览器:${browser};` + setZoneVisits({url,username,uuid,remark}) + },[]) useEffect(()=>{ if(id){ diff --git a/src/forge/Information/Pages/headerPage.jsx b/src/forge/Information/Pages/headerPage.jsx index 654fa1dc7..3060d378f 100644 --- a/src/forge/Information/Pages/headerPage.jsx +++ b/src/forge/Information/Pages/headerPage.jsx @@ -7,7 +7,8 @@ import shijian from '../img/shijian.png'; import { getHomePageList , gethomePageDocList , getAllList, getPartnerList } from '../api'; import axios from 'axios'; import Partner from '../Component/partner'; - +import {getUniqueIdentifier,getUserName,getBrowserPlatform,getBrowserBrand} from '../utils' +import {setZoneVisits} from '../api' function HeaderPage(props){ const [ projectList , setProjectList ] = useState(undefined); const [ personList , setPersonList ] = useState(undefined); @@ -16,6 +17,17 @@ function HeaderPage(props){ const { deptId } = props.match.params; const { data, id, temp } = props; + useEffect(()=>{ + let uuid = getUniqueIdentifier() + let url = props.location.pathname + let platform = getBrowserPlatform() + let browser = getBrowserBrand() + let username = getUserName(props.current_user) + // if(!username) uuid = getUniqueIdentifier() + let remark = ` 操作系统:${platform};浏览器:${browser};` + setZoneVisits({url,username,uuid,remark}) + },[]) + useEffect(()=>{ if(id){ getProjectList(); diff --git a/src/forge/Information/Pages/headerPageZone1.jsx b/src/forge/Information/Pages/headerPageZone1.jsx index 92735fa8e..5fc23f127 100644 --- a/src/forge/Information/Pages/headerPageZone1.jsx +++ b/src/forge/Information/Pages/headerPageZone1.jsx @@ -30,7 +30,8 @@ import ra from '../img/ra.png' import title from '../img/title.png' import Partner from '../Component/partner'; import '../indexZone1.scss'; -import { getProjectsLists, getPartnerList, getHomePageList, gethomePageDocList , getDocList , getSubDocList } from '../api' +import { getProjectsLists, getPartnerList, getHomePageList, gethomePageDocList , getDocList , getSubDocList,setZoneVisits } from '../api' +import {getUniqueIdentifier,getUserName,getBrowserPlatform,getBrowserBrand} from '../utils' function HeaderPage(props){ @@ -72,6 +73,18 @@ function HeaderPage(props){ { title: '成长认证', icon: intro3, desc: '开发者可以通过完成开源项⽬对应的任务,赢取对应能⼒成长认证,开源项⽬对应的⾼级任务将获得对应等级L2或⾼级别的知识产权授权,同时解锁下⼀级别成长任务' }, { title: '顶级认证', icon: intro4, desc: '参与顶级项⽬“⾹⼭”的贡献者,将获得中国科学院计算技术研究所副所长、研究员,北京开源芯⽚研究院⾸席科学家,RISC-V国际基⾦会理事会成员包云岗签名贡献者证书' } ] + + useEffect(()=>{ + let uuid = getUniqueIdentifier() + let url = props.location.pathname + let platform = getBrowserPlatform() + let browser = getBrowserBrand() + let username = getUserName(props.current_user) + // if(!username) uuid = getUniqueIdentifier() + let remark = ` 操作系统:${platform};浏览器:${browser};` + setZoneVisits({url,username,uuid,remark}) + },[]) + useEffect(()=>{ if(id){ // getProjectList(); diff --git a/src/forge/Information/Pages/headerPagebyCCF.jsx b/src/forge/Information/Pages/headerPagebyCCF.jsx index 6aec57866..81bffc522 100644 --- a/src/forge/Information/Pages/headerPagebyCCF.jsx +++ b/src/forge/Information/Pages/headerPagebyCCF.jsx @@ -15,6 +15,9 @@ import "slick-carousel/slick/slick-theme.css"; import Slider from 'react-slick'; import Left from '../../../home/Img/left.png'; import Right from '../../../home/Img/right.png'; +import {getUniqueIdentifier,getUserName,getBrowserPlatform,getBrowserBrand} from '../utils' +import {setZoneVisits} from '../api' + function HeaderPageCCF(props) { @@ -42,6 +45,17 @@ function HeaderPageCCF(props) { afterChange: (index)=> setTag(index) } + useEffect(()=>{ + let uuid = getUniqueIdentifier() + let url = props.location.pathname + let platform = getBrowserPlatform() + let browser = getBrowserBrand() + let username = getUserName(props.current_user) + // if(!username) uuid = getUniqueIdentifier() + let remark = ` 操作系统:${platform};浏览器:${browser};` + setZoneVisits({url,username,uuid,remark}) + },[]) + useEffect(() => { if (id||cateId) { getProjectList(); diff --git a/src/forge/Information/utils.js b/src/forge/Information/utils.js index 7abf1ebde..3113730f8 100644 --- a/src/forge/Information/utils.js +++ b/src/forge/Information/utils.js @@ -16,23 +16,23 @@ export const getUniqueIdentifier = () => { //获取uuid } export const getUserName = (user) => { //获取用户名 - if(user && user.username) return user.username + if(user && user.login) return user.login return '' } export const getBrowserPlatform = () => { const userAgent = navigator.userAgent; let platform; - if (userAgent.indexOf("Win") !== -1) { - platform = "Windows"; - } else if (userAgent.indexOf("Mac") !== -1) { + if (userAgent.includes("Mac")) { platform = "MacOS"; - } else if (userAgent.indexOf("X11") !== -1 || userAgent.indexOf("Linux") !== -1) { + } else if (userAgent.includes("X11") || userAgent.includes("Linux")) { platform = "Linux"; - } else if (userAgent.indexOf("Android") !== -1) { + } else if (userAgent.includes("Android")) { platform = "Android"; - } else if (userAgent.indexOf("like Mac") !== -1) { + } else if (userAgent.includes("iPhone") || userAgent.includes("iPad")) { platform = "iOS"; + } else if (userAgent.includes("Win")) { + platform = "Windows"; } else { platform = "Unknown"; } @@ -45,19 +45,24 @@ export const getBrowserBrand = () => { //获取浏览器信息 let brand = "Unknown"; // 检测浏览器品牌 - if (userAgent.includes("Chrome")) { - brand = "Chrome"; - } else if (userAgent.includes("Firefox")) { + if (userAgent.includes("Firefox")) { brand = "Firefox"; } else if (userAgent.includes("Safari") && !userAgent.includes("Chrome")) { brand = "Safari"; } else if (userAgent.includes("MSIE") || userAgent.includes("Trident")) { brand = "Internet Explorer"; - } else if (userAgent.includes("Edge")) { + } else if (userAgent.includes("Edge") || userAgent.includes("Edg")) { brand = "Edge"; + }else if (userAgent.includes("QQBrowser")) { + brand = "QQBrowser"; + } else if (userAgent.includes("LBBrowser") ) { + brand = "liebao"; + }else if (userAgent.includes("360")) { + brand = "360Browser"; } else if (userAgent.includes("Opera") || userAgent.includes("OPR")) { brand = "Opera"; - } - + } else if (userAgent.includes("Chrome")) { + brand = "Chrome"; + } return brand; } \ No newline at end of file