diff --git a/src/api/order.js b/src/api/order.js index 3f1f2ee2..614adfb3 100644 --- a/src/api/order.js +++ b/src/api/order.js @@ -177,3 +177,23 @@ export function getNewVersion(key){ params: key }) } + +export function getLog(data){ + // 添加log + return request({ + url: '/ureport/pageView/save', + method:'POST', + contentType:'application/json', + data + }) +} + + +//获取最新版本 +export function getUserBO(){ + return request({ + url: '/base/user/getUserBO', + method:'POST', + }) +} + diff --git a/src/utils/myMixins.js b/src/utils/myMixins.js index e8fc59c8..b998a414 100644 --- a/src/utils/myMixins.js +++ b/src/utils/myMixins.js @@ -1,10 +1,13 @@ - +import { getLog } from "@/api/order" export const myMixins = { data() { return { } }, methods: { + async setLogHandler(data) { + await getLog(data) + }, showFun() { if( localStorage.getItem('infoVerify') == 8 || localStorage.getItem('infoVerify') == 12 ) { return false diff --git a/src/views/kpi/kpiIndex.vue b/src/views/kpi/kpiIndex.vue index 6427441d..5e1ca754 100644 --- a/src/views/kpi/kpiIndex.vue +++ b/src/views/kpi/kpiIndex.vue @@ -263,6 +263,7 @@ import { getDriverName,getDriverStatisticsKpi, getRecentSupplierKpi, } from "@/api/kpi.js" +import { getUserBO } from "@/api/order" // querySupplierDriverStatisticsScore import {myMixins} from "@/utils/myMixins" import CircleChar from "@/views/kpi/components/circleChar.vue"; @@ -330,6 +331,10 @@ export default { showScoreChart:true, continueMonthKpi:[], isBtn:false,//是否有信息变更申请按钮权限 + source: 'App', + currentSupplierId: '', + userId: '', + enterTime: dayjs().format('YYYY-MM-DD HH:mm:ss'), } }, created() { @@ -338,13 +343,32 @@ export default { this.isZd = urlParams?.get('isZd') || '' this.supplierId = urlParams?.get('supplierId') || '' this.isBtn= Number(urlParams?.get('isBtn')) + this.source = urlParams?.get('source') || 'App' }, async mounted() { await this.checkMobile(); await this.initDate(); await this.selectSupplierNameHandle(); + await this.getUserInfo(); + this.enterTime = dayjs().format('YYYY-MM-DD HH:mm:ss'); + }, + async beforeDestroy() { + await this.setLogHandler({ + supplierId: this.currentSupplierId, // 服务商 id + userId: this.userId, // userId + source: '服务商KPI', + event: this.source, // 区分 App 还是 system + openTime: this.enterTime, // log 时间,其中 阅读时长是由 enter 和 leave 的时间计算而来 + leaveTime: dayjs().format('YYYY-MM-DD HH:mm:ss'), + }); }, methods: { + async getUserInfo() { + let res = await getUserBO(); + this.userId = res.data.id; + this.currentSupplierId = res.data.supplierId + console.log('getUserBO', res) + }, applicateHandle() { if (window.parent) { const hasListener = window.parent.dispatchEvent(new Event('checkCloseDialog'));