threethousanddream 4 minggu lalu
induk
melakukan
6a831e4698
14 mengubah file dengan 45 tambahan dan 4 penghapusan
  1. 5 0
      App.vue
  2. 1 0
      common/api.js
  3. 8 1
      pages/detail/app.vue
  4. 2 2
      static/common/js/config.js
  5. TEMPAT SAMPAH
      static/img/apps.png
  6. TEMPAT SAMPAH
      static/img/fenxiang-active.png
  7. TEMPAT SAMPAH
      static/img/fenxiang.png
  8. TEMPAT SAMPAH
      static/img/me-active.png
  9. TEMPAT SAMPAH
      static/img/me.png
  10. TEMPAT SAMPAH
      static/img/qiye-active.png
  11. TEMPAT SAMPAH
      static/img/qiye.png
  12. 2 1
      util/index.js
  13. 26 0
      util/sensors.js
  14. 1 0
      util/sensorsdata.es6.min.js

+ 5 - 0
App.vue

@@ -1,8 +1,13 @@
 <script>
 import Cookies from 'js-cookie'
 import {setToken} from '@/util'
+import {useSensors} from "@/util/sensors";
 export default {
   onLaunch: function () {
+    useSensors({
+      commonProps: {platform_type: 'H5'},
+      settings: {},
+    });
     setToken().then(() => {
       uni.$u.http.get('/api/blade-token/currentUser').then(res => {
         let {instType} = res.detail

+ 1 - 0
common/api.js

@@ -28,6 +28,7 @@ export const classifyList = () => request({url: '/bi-api/visual/classify/list',}
 export const reportClassList = () => request({url: '/bi-api/visual/self/report/list',})
 // 系统应用列表
 export const systemAppPage = params => request({url: '/bi-api/microApp/page', params})
+export const appDetail = params => request({url: '/bi-api/microApp/info', params})
 // 我的应用列表
 export const mineAppPage = params => request({url: '/bi-api/microApp/myPage', params})
 // 分享大屏列表

+ 8 - 1
pages/detail/app.vue

@@ -7,6 +7,7 @@
 <script>
 import Cookies from 'js-cookie'
 import {setToken} from "@/util";
+import {appDetail} from "@/common/api";
 export default {
   data() {
     return {
@@ -16,9 +17,15 @@ export default {
   },
   onLoad(options) {
     this.title = options.title
-    setToken().then(() => {
+    appDetail({appId: options.id}).then(res => {
+      let {createUserId,appName}= res.data
       let token = Cookies.get('congress')
       this.url = `${window._CONFIG.APP_READY}?path=miniapp&appid=${options.id}&token=${token}#/newbi/auth`
+      window.$sensors.track('appPreview', {
+        attr1: appName, // 应用名称
+        attr2: options.id, // 应用id
+        attr3: createUserId, // 创建人id
+      });
     })
   }
 }

+ 2 - 2
static/common/js/config.js

@@ -8,6 +8,6 @@ window._CONFIG={
   //iam组件env 用户端inst
   VUE_APP_ENV:'inst',
   // 多用户项目部署地址
-  APP_READY:'http://bi.9n1m.com'
-  
+  APP_READY:'http://bi.9n1m.com',
+  SENSORS_HOST: 'http://sp.platomix.net',
 }

TEMPAT SAMPAH
static/img/apps.png


TEMPAT SAMPAH
static/img/fenxiang-active.png


TEMPAT SAMPAH
static/img/fenxiang.png


TEMPAT SAMPAH
static/img/me-active.png


TEMPAT SAMPAH
static/img/me.png


TEMPAT SAMPAH
static/img/qiye-active.png


TEMPAT SAMPAH
static/img/qiye.png


+ 2 - 1
util/index.js

@@ -17,7 +17,8 @@ export function setToken() {
     if (!Cookies.get('congress')) {
       window.insideH5ToApp({key: 'userInfo', void: 'getUserInfo'})
       setTimeout(() => {
-        setToken().then(resolve)
+        // setToken().then(resolve)
+        resolve()
       }, 50)
     } else {
       resolve()

+ 26 - 0
util/sensors.js

@@ -0,0 +1,26 @@
+import sensors from './sensorsdata.es6.min.js';
+
+// 全局属性
+let defaultCommonProps = {}
+
+export function useSensors(options) {
+  window.$sensors = sensors
+  // 神策系统配置
+  sensors.init({
+    show_log: true,
+    server_url: window._CONFIG.SENSORS_HOST + `/sdata/sa?project=bi&ptype=bi`,
+    // is_track_single_page: false, // 单页面配置,默认开启,若页面中有锚点设计,需要将该配置删除,否则触发锚点会多触发 $pageview 事件
+    use_client_time: true,
+    send_type: 'image',
+    heatmap: {
+      //是否开启点击图,default 表示开启,自动采集 $WebClick 事件,可以设置 'not_collect' 表示关闭。
+      clickmap: 'not_collect',
+      //是否开启触达图,not_collect 表示关闭,不会自动采集 $WebStay 事件,可以设置 'default' 表示开启。
+      scroll_notice_map: 'not_collect',
+    },
+  });
+
+  // 配置全局属性
+  sensors.registerPage(Object.assign({}, defaultCommonProps, options.commonProps));
+
+}

File diff ditekan karena terlalu besar
+ 1 - 0
util/sensorsdata.es6.min.js