Bladeren bron

下载操作埋点上报

任一存 2 jaren geleden
bovenliggende
commit
bcd5976acd
3 gewijzigde bestanden met toevoegingen van 17 en 7 verwijderingen
  1. 7 7
      .eslintrc.js
  2. 6 0
      src/api.js
  3. 4 0
      src/views/DeviceList.vue

+ 7 - 7
.eslintrc.js

@@ -46,12 +46,12 @@ module.exports = {
     'no-prototype-builtins': "off",
   },
   globals: {
-    api: true,
-    config: true,
-    mapState: true,
-    mapGetters: true,
-    mapMutations: true,
-    store: true,
-    utils: true,
+    globalApi: true,
+    globalConfig: true,
+    globalMapState: true,
+    globalMapGetters: true,
+    globalMapMutations: true,
+    globalStore: true,
+    globalUtils: true,
   }
 }

+ 6 - 0
src/api.js

@@ -9,4 +9,10 @@ export default {
     console.assert(res.data.code === 0, 'getDeviceList error')
     return res.data.data
   },
+  async reportDownload(id) {
+    const res = await axios({
+      method: 'get',
+      url: `${process.env.VUE_APP_API_URL_PREFIX}/api/show/visit/product/${id}`
+    })
+  },
 }

+ 4 - 0
src/views/DeviceList.vue

@@ -59,6 +59,7 @@
                 v-if="itemLevel4.fileName && itemLevel4.filePath"
                 :href="itemLevel4.filePath"
                 :download="itemLevel4.fileName"
+                @click="onDownload(itemLevel4)"
               >
                 {{ itemLevel4.fileName }}
               </a>
@@ -94,6 +95,9 @@ export default {
     },
     onClickDeviceIcon(e) {
       e.target.nextSibling.click()
+    },
+    onDownload(deviceInfo) {
+      globalApi.reportDownload(deviceInfo.id)
     }
   }
 }