From 38dfb0c8c22dbe1ab6db5aed150f71453b29f33a Mon Sep 17 00:00:00 2001 From: hejin Date: Wed, 15 Oct 2025 21:23:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BD=91=E9=A1=B5=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E9=87=8F=E6=8E=A5=E5=8F=A3=E8=B0=83=E7=94=A8=E6=97=B6?= =?UTF-8?q?=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- middleware/burying-point.js | 11 ----------- plugins/router.js | 13 ++++++++++++- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/middleware/burying-point.js b/middleware/burying-point.js index 8ef0041..0253cee 100644 --- a/middleware/burying-point.js +++ b/middleware/burying-point.js @@ -1,21 +1,10 @@ export default async function ({ - $axios, store, req }) { let userAgent = process.server ? req.headers['user-agent'] : navigator.userAgent - let url = process.server ? req.headers['referer'] : window.location.href const isMobile = (userAgent) => { return /Mobile|Android|iPhone|iPad|iPod|Opera Mini|IEMobile|BlackBerry|webOS/i.test(userAgent); } store.commit('SET_DEVICE', isMobile(userAgent)) - - let data = { - url, - equipment: store.state.device, - } - if (url && url !== '') { - console.log("url", url) - $axios.post('/web/pageSave',data) - } } \ No newline at end of file diff --git a/plugins/router.js b/plugins/router.js index 13ccc29..4203e7c 100644 --- a/plugins/router.js +++ b/plugins/router.js @@ -1,6 +1,17 @@ -export default ({ app,$cookies,$config, store }) => { +export default ({ app,$cookies,$config, store, $axios }) => { app.router.beforeEach((to, from, next) => { app.i18n.locale = store.state.locale next() }) + app.router.afterEach((to, from) => { + if (process.client) { + let data = { + url: window.location.href, + equipment: store.state.device, + } + if (data.url && data.url !== '') { + $axios.post('/web/pageSave',data) + } + } + }) }