其余首页埋点

This commit is contained in:
qiukai 2024-11-27 14:27:48 +08:00
parent b62bc25370
commit 0f09a0e8b0
5 changed files with 72 additions and 15 deletions

View File

@ -15,6 +15,8 @@ import PartnerJcc from './Component/partnerJcc';
import '../../indexZone1.scss' import '../../indexZone1.scss'
import './index.scss' import './index.scss'
import { Popover, Tabs } from 'antd'; import { Popover, Tabs } from 'antd';
import {getUniqueIdentifier,getUserName,getBrowserPlatform,getBrowserBrand} from '../../utils'
import {setZoneVisits} from '../../api'
let tabTimer = undefined; let tabTimer = undefined;
@ -33,6 +35,17 @@ function HeaderPageJCC(props){
{imageUrl: visionZy, title: '资源易共享'}, {imageUrl: visionZy, title: '资源易共享'},
{imageUrl: visionJz, 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(()=>{ useEffect(()=>{
if(id){ if(id){

View File

@ -7,7 +7,8 @@ import shijian from '../img/shijian.png';
import { getHomePageList , gethomePageDocList , getAllList, getPartnerList } from '../api'; import { getHomePageList , gethomePageDocList , getAllList, getPartnerList } from '../api';
import axios from 'axios'; import axios from 'axios';
import Partner from '../Component/partner'; import Partner from '../Component/partner';
import {getUniqueIdentifier,getUserName,getBrowserPlatform,getBrowserBrand} from '../utils'
import {setZoneVisits} from '../api'
function HeaderPage(props){ function HeaderPage(props){
const [ projectList , setProjectList ] = useState(undefined); const [ projectList , setProjectList ] = useState(undefined);
const [ personList , setPersonList ] = useState(undefined); const [ personList , setPersonList ] = useState(undefined);
@ -16,6 +17,17 @@ function HeaderPage(props){
const { deptId } = props.match.params; const { deptId } = props.match.params;
const { data, id, temp } = props; 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(()=>{ useEffect(()=>{
if(id){ if(id){
getProjectList(); getProjectList();

View File

@ -30,7 +30,8 @@ import ra from '../img/ra.png'
import title from '../img/title.png' import title from '../img/title.png'
import Partner from '../Component/partner'; import Partner from '../Component/partner';
import '../indexZone1.scss'; 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){ function HeaderPage(props){
@ -72,6 +73,18 @@ function HeaderPage(props){
{ title: '成长认证', icon: intro3, desc: '开发者可以通过完成开源项⽬对应的任务赢取对应能⼒成长认证开源项⽬对应的⾼级任务将获得对应等级L2或⾼级别的知识产权授权同时解锁下⼀级别成长任务' }, { title: '成长认证', icon: intro3, desc: '开发者可以通过完成开源项⽬对应的任务赢取对应能⼒成长认证开源项⽬对应的⾼级任务将获得对应等级L2或⾼级别的知识产权授权同时解锁下⼀级别成长任务' },
{ title: '顶级认证', icon: intro4, desc: '参与顶级项⽬“⾹⼭”的贡献者将获得中国科学院计算技术研究所副所长、研究员北京开源芯⽚研究院⾸席科学家RISC-V国际基⾦会理事会成员包云岗签名贡献者证书' } { 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(()=>{ useEffect(()=>{
if(id){ if(id){
// getProjectList(); // getProjectList();

View File

@ -15,6 +15,9 @@ import "slick-carousel/slick/slick-theme.css";
import Slider from 'react-slick'; import Slider from 'react-slick';
import Left from '../../../home/Img/left.png'; import Left from '../../../home/Img/left.png';
import Right from '../../../home/Img/right.png'; import Right from '../../../home/Img/right.png';
import {getUniqueIdentifier,getUserName,getBrowserPlatform,getBrowserBrand} from '../utils'
import {setZoneVisits} from '../api'
function HeaderPageCCF(props) { function HeaderPageCCF(props) {
@ -42,6 +45,17 @@ function HeaderPageCCF(props) {
afterChange: (index)=> setTag(index) 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(() => { useEffect(() => {
if (id||cateId) { if (id||cateId) {
getProjectList(); getProjectList();

View File

@ -16,23 +16,23 @@ export const getUniqueIdentifier = () => { //获取uuid
} }
export const getUserName = (user) => { //获取用户名 export const getUserName = (user) => { //获取用户名
if(user && user.username) return user.username if(user && user.login) return user.login
return '' return ''
} }
export const getBrowserPlatform = () => { export const getBrowserPlatform = () => {
const userAgent = navigator.userAgent; const userAgent = navigator.userAgent;
let platform; let platform;
if (userAgent.indexOf("Win") !== -1) { if (userAgent.includes("Mac")) {
platform = "Windows";
} else if (userAgent.indexOf("Mac") !== -1) {
platform = "MacOS"; platform = "MacOS";
} else if (userAgent.indexOf("X11") !== -1 || userAgent.indexOf("Linux") !== -1) { } else if (userAgent.includes("X11") || userAgent.includes("Linux")) {
platform = "Linux"; platform = "Linux";
} else if (userAgent.indexOf("Android") !== -1) { } else if (userAgent.includes("Android")) {
platform = "Android"; platform = "Android";
} else if (userAgent.indexOf("like Mac") !== -1) { } else if (userAgent.includes("iPhone") || userAgent.includes("iPad")) {
platform = "iOS"; platform = "iOS";
} else if (userAgent.includes("Win")) {
platform = "Windows";
} else { } else {
platform = "Unknown"; platform = "Unknown";
} }
@ -45,19 +45,24 @@ export const getBrowserBrand = () => { //获取浏览器信息
let brand = "Unknown"; let brand = "Unknown";
// 检测浏览器品牌 // 检测浏览器品牌
if (userAgent.includes("Chrome")) { if (userAgent.includes("Firefox")) {
brand = "Chrome";
} else if (userAgent.includes("Firefox")) {
brand = "Firefox"; brand = "Firefox";
} else if (userAgent.includes("Safari") && !userAgent.includes("Chrome")) { } else if (userAgent.includes("Safari") && !userAgent.includes("Chrome")) {
brand = "Safari"; brand = "Safari";
} else if (userAgent.includes("MSIE") || userAgent.includes("Trident")) { } else if (userAgent.includes("MSIE") || userAgent.includes("Trident")) {
brand = "Internet Explorer"; brand = "Internet Explorer";
} else if (userAgent.includes("Edge")) { } else if (userAgent.includes("Edge") || userAgent.includes("Edg")) {
brand = "Edge"; 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")) { } else if (userAgent.includes("Opera") || userAgent.includes("OPR")) {
brand = "Opera"; brand = "Opera";
} } else if (userAgent.includes("Chrome")) {
brand = "Chrome";
}
return brand; return brand;
} }