埋点引入gx

This commit is contained in:
duanxiaohai 2024-11-14 16:37:37 +08:00
parent c923174d85
commit f94d53ec0f
6 changed files with 176 additions and 12 deletions

View File

@ -10,6 +10,55 @@
src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=2KLQUajGSpNL2DInxT6BwdPklMNpG3hw"></script> -->
</head>
<script src='https://wpkgate-emas.ding.zj.gov.cn/static/wpk-jssdk.1.0.2/wpkReporter.js' crossorigin='true'></script>
<script>
try {
const config = {
bid: 'lyxjbggfwjzzfxt_zzdpro',
signkey: '1234567890abcdef',
gateway: 'https://wpkgate-emas.ding.zj.gov.cn'
};
const wpk = new wpkReporter(config);
wpk.installAll();
window._wpk = wpk;
console.log(wpk,'稳定性监控开启');
} catch (err) {
console.error('WpkReporter init fail', err);
}
</script>
<!-- 流量分析监控 -->
<!-- 通用采集 SDK -->
<script>
(function(w, d, s, q, i) {
w[q] = w[q] || [];
var f = d.getElementsByTagName(s)[0],j = d.createElement(s);
j.async = true;
j.id = 'beacon-aplus';
j.src = 'https://alidt.alicdn.com/alilog/mlog/aplus_cloud.js';
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'aplus_queue');
aplus_queue.push({
action: 'aplus.setMetaInfo',
arguments: ['aplus-rhost-v', 'alog-api.ding.zj.gov.cn']
});
aplus_queue.push({
action: 'aplus.setMetaInfo',
arguments: ['aplus-rhost-g', 'alog-api.ding.zj.gov.cn']
});
var u = navigator.userAgent
var isAndroid = u.indexOf('Android') > -1
var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
aplus_queue.push({
action: 'aplus.setMetaInfo',
arguments: ['appId', isAndroid ? '28302650' : isIOS ? '28328447' : '47130293']
});
</script>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>

View File

@ -0,0 +1,13 @@
// 应用配置项,需按实际项目进行修改
const appConfig = {
SappId: "48017",
SappName: "lyxjbggfwjzzfxt",
appKey: "lyxjbggfwjzzfxt-1D38yW3MZJ3mee", // 应用APPKey
// serviceCode: '123456', // 单点登录代码
// servicePwd: '123456', // 单点登录密码
// appCode: 'test', // 应用编码,
// accessKey: '', // AK,IRS组件商店查看
// secret: '', // SK,IRS组件商店查看
};
export default appConfig;

View File

@ -0,0 +1,79 @@
import appConfig from './config/index.js';
// import { inject } from 'vue'
// const users = inject("user"); //引入
//接收3个参数page_idpage_namepage_url
export function queue(metaId, metaName, metaPath,) {
// console.log(Vue.prototype.getzzduserId,Vue.prototype.getzzdname)
// console.log(metaId, metaName, metaPath, '1111111111111111111111111')
//单页应用或“单个页面”需异步补充PV日志参数还需进行如下埋点
// console.log('执行埋点')
// console.log(users);
//基础埋点
aplus_queue.push({
action: 'aplus.setMetaInfo',
arguments: ['aplus-waiting', 'MAN']
}); //
// 单页应用路由切换后 或 在异步获取到pv日志所需的参数后再执行sendPV
aplus_queue.push({
'action': 'aplus.sendPV',
'arguments': [{
is_auto: false
}, {
//当前你的应用信息,此两行按应用实际参数修改,不可自定义。
sapp_id: appConfig.SappId,
sapp_name: appConfig.SappName,
// 自定义PV参数key-value键值对只能是这种平铺的json不能做多层嵌套
page_id: metaId, //'页面ID与page 参数配合使用,保证唯一性',
page_name: metaName, //'页面中文名称'
page_url: metaPath
}]
})
//用户信息埋点
// 如采集用户信息是异步行为需要先执行这个BLOCK埋点
aplus_queue.push({
action: 'aplus.setMetaInfo',
arguments: ['_hold', 'BLOCK']
});
// 设置会员昵称
aplus_queue.push({
action: "aplus.setMetaInfo",
arguments: ["_user_nick", localStorage.getItem('getzzdname') || 'login'],
});
// 设置会员ID
aplus_queue.push({
action: "aplus.setMetaInfo",
arguments: ["_user_id", localStorage.getItem('getzzduserId') || '40906000']
});
// aplus_queue.push({
// action: "aplus.setMetaInfo",
// arguments: ["_dev_id", "yourDeviceId"]
// });
// 如采集用户信息是异步行为需要先设置完用户信息后再执行这个START埋点
// 此时被block住的日志会携带上用户信息逐条发出
aplus_queue.push({
action: 'aplus.setMetaInfo',
arguments: ['_hold', 'START']
});
//埋点end
// for (const key in aplus_queue) {
// console.log(aplus_queue[key]);
// }
// console.log(window.aplus_queue);
// console.log(localStorage.getItem('getzzdname'), localStorage.getItem('getzzduserId'));
};

View File

@ -3,6 +3,8 @@ import http from "@/utils/request.js";
import tools from "@/utils/tools";
// import { namespaceContextKey } from "element-plus";
import { ElMessage, ElMessageBox } from "element-plus";
import { queue } from "../assets/zzdcommon/zzdlog";
const routerHistory = createWebHashHistory();
const router = createRouter({
@ -15,140 +17,162 @@ const router = createRouter({
{
name: "引导页",
path: "/guide",
meta: { id: "1" },
component: () => import("../view/guide.vue"),
},
{
name: "401",
path: "/error/401",
meta: { id: "2" },
component: () => import("../view/error/401.vue"),
},
{
name: "403",
path: "/error/403",
meta: { id: "3" },
component: () => import("../view/error/403.vue"),
},
{
name: "404",
path: "/error/404",
meta: { id: "4" },
component: () => import("../view/error/404.vue"),
},
{
name: "500",
path: "/error/500",
meta: { id: "5" },
component: () => import("../view/error/500.vue"),
},
{
name: "无网络",
path: "/error/noNetwork",
meta: { id: "6" },
component: () => import("../view/error/noNetwork.vue"),
},
{
name: "建设中",
path: "/error/emptyPage",
meta: { id: "7" },
component: () => import("../view/error/emptyPage.vue"),
},
{
name: "查询为空",
path: "/error/noResults",
meta: { id: "8" },
component: () => import("../view/error/noResults.vue"),
},
{
name: "通用空页面",
path: "/error/noConstruction",
meta: { id: "9" },
component: () => import("../view/error/noConstruction.vue"),
},
{
name: "未享受人员",
path: "/person/rwTable",
meta: { id: "10" },
component: () => import("../view/person/rwTable.vue"),
},
{
name: "人员推送详情",
path: "/person/pushRecords",
meta: { id: "11" },
component: () => import("../view/person/pushRecords.vue"),
},
{
name: "主页",
path: "/home",
meta: { id: "25" },
component: () => import("../view/home.vue"),
children: [
{
name: "首页",
path: "/home/index",
meta: { id: "12" },
component: () => import("../view/sy.vue"),
},
{
name: "养老",
path: "/home/yl",
meta: { id: "13" },
component: () => import("../view/yl.vue"),
},
{
name: "卫生",
path: "/home/hygiene",
meta: { id: "14" },
component: () => import("../view/hygiene.vue"),
},
{
name: "教育",
path: "/home/education",
meta: { id: "15" },
component: () => import("../view/education.vue"),
},
{
name: "就业补助",
path: "/home/work",
meta: { id: "16" },
component: () => import("../view/work.vue"),
},
{
name: "智能分析",
path: "/home/analyze",
meta: { id: "17" },
component: () => import("../view/analyze.vue"),
},
{
name: "首页地图",
path: "/home/index/map",
meta: { id: "18" },
component: () => import("../view/sy_map.vue"),
},
{
name: "首页表格",
path: "/home/index/table",
meta: { id: "19" },
component: () => import("../view/sy_table.vue"),
},
{
name: "首页表格详情",
path: "/home/index/table/details",
meta: { id: "20" },
component: () => import("../view/sy_details.vue"),
},
{
name: "首页表格交通便利详情",
path: "/home/index/table/jtDetails",
meta: { id: "21" },
component: () => import("../view/jt_details.vue"),
},
{
name: "首页表格全民健身服务详情",
path: "/home/index/table/fitnessServices",
meta: { id: "22" },
component: () => import("../view/js_details.vue"),
},
{
name: "首页表格校外活动服务详情",
path: "/home/index/table/afterschoolActivities",
meta: { id: "23" },
component: () => import("../view/hd_details.vue"),
},
{
name: "人物图",
path: "/home/index/person",
meta: { id: "24" },
component: () => import("../view/person/index.vue"),
},
// {
// name: '地图编辑',
// path: '/home/index/mapEdit',
// component: () => import('../view/sy_map_fb.vue'),
// },
],
},
],
});
router.beforeEach((to, form, next) => {
console.log(to);
queue(to.meta.id, to.name, to.path);
let menu = tools.data.get("menu");
let token = tools.data.get("token");
// var token = getCookie('lytoken')
@ -176,9 +200,9 @@ router.beforeEach((to, form, next) => {
if (!token) {
next();
} else {
if (to.fullPath == '/home/index/map') {
if (to.fullPath == "/home/index/map") {
//当未重新登录时menu为空或没有权限标识无法访问
if (!menu || menu.indexOf('ggfw:ystp') == -1) {
if (!menu || menu.indexOf("ggfw:ystp") == -1) {
ElMessage.error("您无权限访问该模块,若有需求请联系大数据中心!");
} else {
next();
@ -188,7 +212,6 @@ router.beforeEach((to, form, next) => {
}
}
// next();
});

View File

@ -137,8 +137,6 @@ const getCookie = (cname) => {
};
//
const login = () => {
console.log(111111111);
let backurl = tools.data.get("backUrl");
dd.getAuthCode()
.then((res) => {

View File

@ -130,6 +130,7 @@ const data = reactive({
{
label: "时间",
property: "sj",
width: "150",
align: "center",
},
{
@ -145,6 +146,7 @@ const data = reactive({
{
label: "人数",
property: "rs",
width: "150",
align: "center",
},
],