特色专区前端埋点
This commit is contained in:
parent
347c7721d9
commit
b62bc25370
|
@ -9,6 +9,8 @@ import RenderHtml from '../../../components/render-html';
|
||||||
import { Base64 } from 'js-base64';
|
import { Base64 } from 'js-base64';
|
||||||
import { getTocContent } from '../../../common/marked';
|
import { getTocContent } from '../../../common/marked';
|
||||||
import TreeByWikiSidebar from '../../Wiki/components/treeByWikiSidebar';
|
import TreeByWikiSidebar from '../../Wiki/components/treeByWikiSidebar';
|
||||||
|
import {getUniqueIdentifier,getUserName,getBrowserPlatform,getBrowserBrand} from '../utils';
|
||||||
|
import {setZoneVisits} from '../api'
|
||||||
|
|
||||||
function ProjectSource(props) {
|
function ProjectSource(props) {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
@ -102,7 +104,17 @@ function ProjectSource(props) {
|
||||||
})
|
})
|
||||||
}, [wikiDetail])
|
}, [wikiDetail])
|
||||||
|
|
||||||
|
|
||||||
useEffect(() =>{
|
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})
|
||||||
// 点击事件
|
// 点击事件
|
||||||
const handleClick = (event) => {
|
const handleClick = (event) => {
|
||||||
let target = event.target;
|
let target = event.target;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React,{ } from 'react';
|
import React,{ useEffect , useState } from 'react';
|
||||||
import Introduction from './component/introduction';
|
import Introduction from './component/introduction';
|
||||||
import News from './component/news';
|
import News from './component/news';
|
||||||
import Project from './component/project';
|
import Project from './component/project';
|
||||||
|
@ -8,8 +8,21 @@ import Partner from './component/partner';
|
||||||
import SpecialProjects from './component/specialProjects';
|
import SpecialProjects from './component/specialProjects';
|
||||||
import '../../indexZone1.scss'
|
import '../../indexZone1.scss'
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
|
import {getUniqueIdentifier,getUserName,getBrowserPlatform,getBrowserBrand} from '../../utils'
|
||||||
|
import {setZoneVisits} from '../../api'
|
||||||
|
|
||||||
|
|
||||||
function HeaderPageUos(props){
|
function HeaderPageUos(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})
|
||||||
|
},[])
|
||||||
const { data } = props;
|
const { data } = props;
|
||||||
|
|
||||||
return(
|
return(
|
||||||
|
|
|
@ -13,6 +13,8 @@ import DefaultImg from '../Component/defaultImg';
|
||||||
import { getNewsAllList , getNewsHotList } from '../api';
|
import { getNewsAllList , getNewsHotList } from '../api';
|
||||||
import { tempConfig, tempEnum } from '../tempInfo';
|
import { tempConfig, tempEnum } from '../tempInfo';
|
||||||
import { httpUrl } from '../fetch';
|
import { httpUrl } from '../fetch';
|
||||||
|
import {getUniqueIdentifier,getUserName,getBrowserPlatform,getBrowserBrand} from '../utils';
|
||||||
|
import {setZoneVisits} from '../api'
|
||||||
|
|
||||||
|
|
||||||
function Main(props){
|
function Main(props){
|
||||||
|
@ -26,7 +28,16 @@ function Main(props){
|
||||||
const { deptId , cateId } = props.match.params;
|
const { deptId , cateId } = props.match.params;
|
||||||
const { id, temp, role, history, sectionCmsTitle } = props;
|
const { id, temp, role, history, sectionCmsTitle } = 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})
|
||||||
|
},[])
|
||||||
const menu = (
|
const menu = (
|
||||||
<Menu>
|
<Menu>
|
||||||
<Menu.Item>
|
<Menu.Item>
|
||||||
|
|
|
@ -12,6 +12,8 @@ import CommentList from '../Component/comments/list'
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { withRouter } from "react-router";
|
import { withRouter } from "react-router";
|
||||||
import { setZoneDetail, setNewsDetail } from '../../../redux/actions/server';
|
import { setZoneDetail, setNewsDetail } from '../../../redux/actions/server';
|
||||||
|
import {getUniqueIdentifier,getUserName,getBrowserPlatform,getBrowserBrand} from '../utils';
|
||||||
|
import {setZoneVisits} from '../api'
|
||||||
|
|
||||||
|
|
||||||
function NewsDetail(props){
|
function NewsDetail(props){
|
||||||
|
@ -28,6 +30,16 @@ function NewsDetail(props){
|
||||||
setMeta()
|
setMeta()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(()=>{
|
||||||
let initialContent = undefined;
|
let initialContent = undefined;
|
||||||
// 设置网页标题
|
// 设置网页标题
|
||||||
|
|
|
@ -8,7 +8,8 @@ import axios from 'axios';
|
||||||
import { getProjectsLists , getProjectsTypeLists } from '../api';
|
import { getProjectsLists , getProjectsTypeLists } from '../api';
|
||||||
import nodata from '../img/nodata.png';
|
import nodata from '../img/nodata.png';
|
||||||
import { tempEnum } from '../tempInfo';
|
import { tempEnum } from '../tempInfo';
|
||||||
|
import {getUniqueIdentifier,getUserName,getBrowserPlatform,getBrowserBrand} from '../utils'
|
||||||
|
import {setZoneVisits} from '../api'
|
||||||
const { Search } = Input;
|
const { Search } = Input;
|
||||||
|
|
||||||
function ProjectSource(props){
|
function ProjectSource(props){
|
||||||
|
@ -23,6 +24,16 @@ function ProjectSource(props){
|
||||||
const [ value , setValue ] = useState(undefined);
|
const [ value , setValue ] = useState(undefined);
|
||||||
const [ loading , setLoading ] = useState(false);
|
const [ loading , setLoading ] = useState(false);
|
||||||
const { id, temp, sectionProjectTitle } = props;
|
const { id, temp, sectionProjectTitle } = 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){
|
||||||
|
|
|
@ -8,6 +8,8 @@ import Nodata from '../../Nodata';
|
||||||
import ImgGreen from '../img/green_nodata.png';
|
import ImgGreen from '../img/green_nodata.png';
|
||||||
import '../indexZone1.scss';
|
import '../indexZone1.scss';
|
||||||
import { FlexAJ } from '../../Component/layout';
|
import { FlexAJ } from '../../Component/layout';
|
||||||
|
import {getUniqueIdentifier,getUserName,getBrowserPlatform,getBrowserBrand} from '../utils';
|
||||||
|
import {setZoneVisits} from '../api'
|
||||||
|
|
||||||
const { Search } = Input;
|
const { Search } = Input;
|
||||||
|
|
||||||
|
@ -25,6 +27,17 @@ function Source(props){
|
||||||
const limit = 21;
|
const limit = 21;
|
||||||
const { id , temp, history, role, sectionResourceTitle } = props;
|
const { id , temp, history, role, sectionResourceTitle } = 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(()=>{
|
||||||
id && getLists();
|
id && getLists();
|
||||||
},[id,chooseTypeId,chooseZoneId,page,search])
|
},[id,chooseTypeId,chooseZoneId,page,search])
|
||||||
|
|
|
@ -7,6 +7,8 @@ import { httpUrl } from '../fetch';
|
||||||
import { AlignCenter, FlexAJ } from '../../Component/layout';
|
import { AlignCenter, FlexAJ } from '../../Component/layout';
|
||||||
import SourceIcon from '../img/sourceIcon.png';
|
import SourceIcon from '../img/sourceIcon.png';
|
||||||
import { addMeta, setSeoMeta } from 'educoder';
|
import { addMeta, setSeoMeta } from 'educoder';
|
||||||
|
import {getUniqueIdentifier,getUserName,getBrowserPlatform,getBrowserBrand} from '../utils';
|
||||||
|
import {setZoneVisits} from '../api'
|
||||||
|
|
||||||
|
|
||||||
function SourceDetail(props){
|
function SourceDetail(props){
|
||||||
|
@ -15,6 +17,17 @@ function SourceDetail(props){
|
||||||
const zonedetail = props.data;
|
const zonedetail = props.data;
|
||||||
const {temp} = props;
|
const {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(sourceid){
|
if(sourceid){
|
||||||
getDetails();
|
getDetails();
|
||||||
|
|
|
@ -8,6 +8,8 @@ import MemberApply from '../Component/memberApply';
|
||||||
import { getVIPLists, getAuditStatus, applyJoin } from '../api';
|
import { getVIPLists, getAuditStatus, applyJoin } from '../api';
|
||||||
import nodata from '../img/nodata.png';
|
import nodata from '../img/nodata.png';
|
||||||
import MemberList from '../Component/memberList';
|
import MemberList from '../Component/memberList';
|
||||||
|
import {getUniqueIdentifier,getUserName,getBrowserPlatform,getBrowserBrand} from '../utils';
|
||||||
|
import {setZoneVisits} from '../api'
|
||||||
|
|
||||||
import '../indexZone1.scss';
|
import '../indexZone1.scss';
|
||||||
|
|
||||||
|
@ -25,6 +27,17 @@ function ZoneVIP(props){
|
||||||
const [ memberStatus , setMemberStatus] = useState(memberStatusEnum.notMember);
|
const [ memberStatus , setMemberStatus] = useState(memberStatusEnum.notMember);
|
||||||
const { id, showNotification, checkIfLogin, showLoginDialog, temp, sectionMemberTitle } = props;
|
const { id, showNotification, checkIfLogin, showLoginDialog, temp, sectionMemberTitle } = 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){
|
||||||
setIsSpin(true);
|
setIsSpin(true);
|
||||||
|
|
|
@ -439,3 +439,11 @@ export function getRoleList(){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 组织升级为企业
|
||||||
|
export function setZoneVisits(data) {
|
||||||
|
return fetch({
|
||||||
|
url: `/zone/open/zoneVisits`,
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -115,7 +115,6 @@ function Index(props){
|
||||||
const sourcedetail = pathname.indexOf(`/zone/${deptId}/newdetail/`)>-1 && isPhone();
|
const sourcedetail = pathname.indexOf(`/zone/${deptId}/newdetail/`)>-1 && isPhone();
|
||||||
const {current_user} = props;
|
const {current_user} = props;
|
||||||
|
|
||||||
console.log('deptId', deptId);
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
|
@ -149,8 +148,9 @@ function Index(props){
|
||||||
}
|
}
|
||||||
setData(data);
|
setData(data);
|
||||||
document.title= data && data.mainTitle;
|
document.title= data && data.mainTitle;
|
||||||
|
|
||||||
|
if(data && data.id){
|
||||||
setId(data.id);
|
setId(data.id);
|
||||||
if(data.id){
|
|
||||||
getAdminUrl(data.id);
|
getAdminUrl(data.id);
|
||||||
getRole(data.id)
|
getRole(data.id)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
export const generateUUID = () => { //生成uuid
|
||||||
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
||||||
|
var r = Math.random() * 16 | 0,
|
||||||
|
v = c === 'x' ? r : (r & 0x3 | 0x8);
|
||||||
|
return v.toString(16);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getUniqueIdentifier = () => { //获取uuid
|
||||||
|
let uniqueId = localStorage.getItem('uniqueId');
|
||||||
|
if (!uniqueId) {
|
||||||
|
uniqueId = generateUUID();
|
||||||
|
localStorage.setItem('uniqueId', uniqueId);
|
||||||
|
}
|
||||||
|
return uniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getUserName = (user) => { //获取用户名
|
||||||
|
if(user && user.username) return user.username
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getBrowserPlatform = () => {
|
||||||
|
const userAgent = navigator.userAgent;
|
||||||
|
let platform;
|
||||||
|
if (userAgent.indexOf("Win") !== -1) {
|
||||||
|
platform = "Windows";
|
||||||
|
} else if (userAgent.indexOf("Mac") !== -1) {
|
||||||
|
platform = "MacOS";
|
||||||
|
} else if (userAgent.indexOf("X11") !== -1 || userAgent.indexOf("Linux") !== -1) {
|
||||||
|
platform = "Linux";
|
||||||
|
} else if (userAgent.indexOf("Android") !== -1) {
|
||||||
|
platform = "Android";
|
||||||
|
} else if (userAgent.indexOf("like Mac") !== -1) {
|
||||||
|
platform = "iOS";
|
||||||
|
} else {
|
||||||
|
platform = "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getBrowserBrand = () => { //获取浏览器信息
|
||||||
|
const userAgent = navigator.userAgent;
|
||||||
|
let brand = "Unknown";
|
||||||
|
|
||||||
|
// 检测浏览器品牌
|
||||||
|
if (userAgent.includes("Chrome")) {
|
||||||
|
brand = "Chrome";
|
||||||
|
} else 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")) {
|
||||||
|
brand = "Edge";
|
||||||
|
} else if (userAgent.includes("Opera") || userAgent.includes("OPR")) {
|
||||||
|
brand = "Opera";
|
||||||
|
}
|
||||||
|
|
||||||
|
return brand;
|
||||||
|
}
|
Loading…
Reference in New Issue