diff --git a/src/router/index.js b/src/router/index.js index d57aa98..e0ee006 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,6 +8,7 @@ import MyOrder from '../pages/MyOrder.vue' import MyAllowance from '../pages/MyAllowance.vue' import MyAllowanceForm from '../pages/MyAllowanceForm.vue' import MyBank from '../pages/MyBank.vue' +import {sendVisitLog} from '@/utils/useStatistics' const routes = [ { path: '/', name: 'Home', component: Home }, @@ -33,5 +34,7 @@ router.afterEach(() => { // arguments: [{ is_auto: false }] // 按文档要求传递固定格式参数 // }) // } + console.log("发送PV统计"); + sendVisitLog(); }) export default router \ No newline at end of file diff --git a/src/utils/useStatistics.js b/src/utils/useStatistics.js new file mode 100644 index 0000000..722b57e --- /dev/null +++ b/src/utils/useStatistics.js @@ -0,0 +1,15 @@ +import api from '@/utils/api' + +export const sendVisitLog = (params) => { + let url = window.location.href + console.log('lcc', url) + let data = { + url, + ...params + } + api.post('/auto/visit', data); +} + +export default { + sendVisitLog +} \ No newline at end of file