shaogen1995 пре 4 месеци
родитељ
комит
89b30e1f21
5 измењених фајлова са 215 додато и 83 уклоњено
  1. 50 0
      public/index.html
  2. 70 0
      src/components/ZmaiDian.ts
  3. 86 83
      src/pages/Layout/data.ts
  4. 7 0
      src/pages/Layout/index.tsx
  5. 2 0
      src/types/declaration.d.ts

+ 50 - 0
public/index.html

@@ -29,6 +29,56 @@
       //   })
       // })
     </script>
+
+    <!-- 埋点开始 -->
+    <script
+      src="https://wpkgate-emas.ding.zj.gov.cn/static/wpk-jssdk.1.0.2/wpkReporter.js"
+      crossorigin="true"
+    ></script>
+    <script>
+      try {
+        const config = {
+          bid: '替换为你自己的bid',
+          signkey: '1234567890abcdef',
+          gateway: 'https://wpkgate-emas.ding.zj.gov.cn'
+        }
+        const wpk = new wpkReporter(config)
+        wpk.installAll()
+        window._wpk = wpk
+      } catch (err) {
+        console.error('WpkReporterinitfail', err)
+      }
+      ;(function (w, d, s, q, i) {
+        w[q] = w[q] || []
+        var f = d.getElementsByTagName(s)[0],
+          j = d.createElement(s)
+        j.async = true
+        j.id = 'beacon-aplus'
+        j.src = 'https://alidt.alicdn.com/alilog/mlog/aplus_cloud.js'
+        f.parentNode.insertBefore(j, f)
+      })(window, document, 'script', 'aplus_queue')
+
+      aplus_queue.push({
+        action: 'aplus.setMetaInfo',
+        //专有云应用,第二个参数在部署时请替换为正确的专有云地址
+        arguments: ['aplus-rhost-v', 'alog-api.ding.zj.gov.cn']
+      })
+      aplus_queue.push({
+        action: 'aplus.setMetaInfo',
+        //专有云应用,第二个参数在部署时请替换为正确的专有云地址
+        arguments: ['aplus-rhost-g', 'alog-api.ding.zj.gov.cn']
+      })
+
+      var u = navigator.userAgent
+      var isAndroid = u.indexOf('Android') > -1
+      var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
+
+      aplus_queue.push({
+        action: 'aplus.setMetaInfo',
+        arguments: ['appId', isAndroid ? '28302650' : isIOS ? '28328447' : '47130293']
+      })
+    </script>
+    <!-- 埋点结束 -->
   </head>
   <body>
     <noscript>You need to enable JavaScript to run this app.</noscript>

+ 70 - 0
src/components/ZmaiDian.ts

@@ -0,0 +1,70 @@
+import tabLeftArr, { routerSon } from '@/pages/Layout/data'
+import { getTokenInfo } from '@/utils/storage'
+
+function setMd(page_id: string, page_name: string, page_url: string, _user_id: string) {
+  // 用户信息埋点----------------------------------------
+  // 单页应用 或 “单个页面”需异步补充PV日志参数还需进行如下埋点 ------
+  aplus_queue.push({
+    action: 'aplus.setMetaInfo',
+    arguments: ['aplus-waiting', 'MAN']
+  })
+  aplus_queue.push({
+    action: 'aplus.sendPV',
+    arguments: [
+      {
+        is_auto: false
+      },
+      {
+        // 当前你的应用信息,此两行按应用实际参数修改,不可自定义。
+        sapp_id: '替换为-业主给你的sapp_id',
+        sapp_name: '替换为-业主给你的sapp_name',
+        page_id: page_id, // 可以用this.$route.meta.pagePath代替
+        page_name: page_name, // 可以用this.$route.meta.name代替
+        page_url: page_url // 可以用this.$route.meta.pagePath代替
+      }
+    ]
+  })
+  aplus_queue.push({
+    action: 'aplus.setMetaInfo',
+    arguments: ['_hold', 'BLOCK']
+  })
+  // 设置会员ID
+  aplus_queue.push({
+    action: 'aplus.setMetaInfo',
+    arguments: ['_user_id', _user_id] // 当前登录的浙政钉用户id,传参示例:uni.getStorageSync('userInfo').employeeCode)
+  })
+
+  // 如采集用户信息是异步行为,需要先设置完用户信息后再执行这个START埋点
+  // 此时被block住的日志会携带上用户信息逐条发出
+  aplus_queue.push({
+    action: 'aplus.setMetaInfo',
+    arguments: ['_hold', 'START']
+  })
+}
+
+export const maiDianFu = (page_id: string) => {
+  const arr = page_id.split('/')
+  let page_name = ''
+
+  routerSon.forEach(v => {
+    const arr2 = v.path.split('/')
+    if (arr[1] === arr2[1]) page_name = v.name
+  })
+
+  if (!page_name) {
+    if (arr[1]) {
+      tabLeftArr.forEach(v1 => {
+        if (v1.son && v1.son.length) {
+          v1.son.forEach(v2 => {
+            const arr2 = v2.path.split('/')
+            if (arr[1] === arr2[1]) page_name = v2.name
+          })
+        }
+      })
+    } else page_name = '数据统计'
+  }
+
+  const _user_id = getTokenInfo().user.accountId || '888708'
+
+  setMd(page_id, page_name, page_id, _user_id)
+}

+ 86 - 83
src/pages/Layout/data.ts

@@ -32,6 +32,7 @@ const tabLeftArr: RouterType = [
       }
     ]
   },
+
   {
     id: 8,
     name: '藏品查询',
@@ -50,71 +51,7 @@ const tabLeftArr: RouterType = [
       }
     ]
   },
-  {
-    id: 9,
-    name: '台账管理',
-    son: [
-      {
-        id: 601,
-        name: '藏品总账',
-        path: '/machineReg',
-        Com: React.lazy(() => import('../A3_ledger/C1ledger'))
-      },
-      {
-        id: 602,
-        name: '藏品分账',
-        path: '/Routing',
-        Com: React.lazy(() => import('../A3_ledger/A32Routing'))
-      }
-    ]
-  },
-  {
-    id: 3,
-    name: '藏品管理',
-    son: [
-      {
-        id: 310,
-        name: '藏品登记',
-        isLog: true,
-        path: '/register',
-        Com: React.lazy(() => import('../C_goodsManage/C1register'))
-      },
 
-      {
-        id: 320,
-        name: '藏品注销',
-        isLog: true,
-        path: '/cancel',
-        Com: React.lazy(() => import('../D_storeManage/D8cancel'))
-      },
-      {
-        id: 330,
-        name: '藏品附件',
-        path: '/files',
-        Com: React.lazy(() => import('../C_goodsManage/C2files'))
-      },
-      {
-        id: 340,
-        name: '资源使用',
-        isLog: true,
-        path: '/wealth',
-        Com: React.lazy(() => import('../C_goodsManage/C21wealth'))
-      },
-      {
-        id: 350,
-        name: '藏品编辑',
-        isLog: true,
-        path: '/goodEdit',
-        Com: React.lazy(() => import('../C_goodsManage/C22goodEdit'))
-      },
-      {
-        id: 360,
-        name: '藏品关注',
-        path: '/focus',
-        Com: React.lazy(() => import('../C_goodsManage/C3focus'))
-      }
-    ]
-  },
   {
     id: 2,
     name: '入藏管理',
@@ -149,7 +86,24 @@ const tabLeftArr: RouterType = [
       }
     ]
   },
-
+  {
+    id: 9,
+    name: '台账管理',
+    son: [
+      {
+        id: 601,
+        name: '藏品总账',
+        path: '/machineReg',
+        Com: React.lazy(() => import('../A3_ledger/C1ledger'))
+      },
+      {
+        id: 602,
+        name: '藏品分账',
+        path: '/Routing',
+        Com: React.lazy(() => import('../A3_ledger/A32Routing'))
+      }
+    ]
+  },
   {
     id: 4,
     name: '库房管理',
@@ -203,6 +157,54 @@ const tabLeftArr: RouterType = [
     ]
   },
   {
+    id: 3,
+    name: '藏品管理',
+    son: [
+      {
+        id: 310,
+        name: '藏品登记',
+        isLog: true,
+        path: '/register',
+        Com: React.lazy(() => import('../C_goodsManage/C1register'))
+      },
+
+      {
+        id: 320,
+        name: '藏品注销',
+        isLog: true,
+        path: '/cancel',
+        Com: React.lazy(() => import('../D_storeManage/D8cancel'))
+      },
+      {
+        id: 330,
+        name: '藏品附件',
+        path: '/files',
+        Com: React.lazy(() => import('../C_goodsManage/C2files'))
+      },
+      {
+        id: 340,
+        name: '资源使用',
+        isLog: true,
+        path: '/wealth',
+        Com: React.lazy(() => import('../C_goodsManage/C21wealth'))
+      },
+      {
+        id: 350,
+        name: '藏品编辑',
+        isLog: true,
+        path: '/goodEdit',
+        Com: React.lazy(() => import('../C_goodsManage/C22goodEdit'))
+      },
+      {
+        id: 360,
+        name: '藏品关注',
+        path: '/focus',
+        Com: React.lazy(() => import('../C_goodsManage/C3focus'))
+      }
+    ]
+  },
+
+  {
     id: 5,
     name: '藏品维护',
     son: [
@@ -236,6 +238,7 @@ const tabLeftArr: RouterType = [
       }
     ]
   },
+
   {
     id: 900,
     name: '展品管理',
@@ -329,14 +332,14 @@ export const routerSon: RouterTypeRow[] = [
   // -------------入库-----------------
   {
     id: 7,
-    name: '入库-新增/编辑/审批/查看',
+    name: '入库-详情页',
     path: '/impStor_edit/:key/:id',
     Com: React.lazy(() => import('../D_storeManage/D4impStor/D4edit'))
   },
   // -------------出库-----------------
   {
     id: 8,
-    name: '出库-新增/编辑/审批/查看',
+    name: '出库-详情页',
     path: '/putsStor_edit/:key/:id',
     Com: React.lazy(() => import('../D_storeManage/D6putsStor/D6edit'))
   },
@@ -344,7 +347,7 @@ export const routerSon: RouterTypeRow[] = [
   // ------------藏品征集------------------
   {
     id: 10,
-    name: '藏品征集-新增/编辑/审批/查看',
+    name: '藏品征集-详情页',
     path: '/collect_edit/:key/:id',
     Com: React.lazy(() => import('../B_enterTibet/B1collect/B1edit'))
   },
@@ -352,14 +355,14 @@ export const routerSon: RouterTypeRow[] = [
   // ------------事故登记------------------
   {
     id: 13,
-    name: '事故登记-新增/编辑/审批/查看',
+    name: '事故登记-详情页',
     path: '/accident_edit/:key/:id',
     Com: React.lazy(() => import('../E_goodsStorage/E1accident/E1edit'))
   },
   // ------------残损登记 甲方说先隐藏------------------
   // {
   //   id: 11,
-  //   name: '残损登记-新增/编辑/审批/查看',
+  //   name: '残损登记-详情页',
   //   path: '/damaged_edit/:key/:id',
   //   Com: React.lazy(() => import('../E_goodsStorage/E2damaged/E2edit'))
   // },
@@ -367,56 +370,56 @@ export const routerSon: RouterTypeRow[] = [
   // ------------现状登记------------------
   {
     id: 12,
-    name: '现状登记-新增/编辑/审批/查看',
+    name: '现状登记-详情页',
     path: '/actuality_edit/:key/:id',
     Com: React.lazy(() => import('../E_goodsStorage/E3actuality/E3edit'))
   },
   // ------------文物修复------------------
   {
     id: 14,
-    name: '文物修复-新增/编辑/审批/查看',
+    name: '文物修复-详情页',
     path: '/repair_edit/:key/:id',
     Com: React.lazy(() => import('../E_goodsStorage/E4repair/E4edit'))
   },
   {
     id: 15,
-    name: '借展管理-新增/编辑/审批/查看',
+    name: '借展管理-详情页',
     path: '/exhibition_edit/:key/:id',
     Com: React.lazy(() => import('../F_exhibition/F1exhibition/F1edit'))
   },
   {
     id: 16,
-    name: '藏品鉴定-新增/编辑/审批/查看',
+    name: '藏品鉴定-详情页',
     path: '/identify_edit/:key/:id',
     Com: React.lazy(() => import('../B_enterTibet/B2identify/B2edit'))
   },
   {
     id: 17,
-    name: '藏品登记-审批/查看',
+    name: '藏品登记-详情页',
     path: '/register_edit/:key/:id',
     Com: React.lazy(() => import('../C_goodsManage/C1register/C1look'))
   },
   {
     id: 18,
-    name: '藏品编辑-审批/查看',
+    name: '藏品编辑-详情页',
     path: '/goodEdit_edit/:key/:id',
     Com: React.lazy(() => import('../C_goodsManage/C22goodEdit/C22look'))
   },
   {
     id: 19,
-    name: '藏品注销-新增、编辑、审批/查看',
+    name: '藏品注销-详情页',
     path: '/cancel_edit/:key/:id',
     Com: React.lazy(() => import('../D_storeManage/D8cancel/D8edit'))
   },
   {
     id: 21,
-    name: '藏品入馆-新增、编辑、审批/查看',
+    name: '藏品入馆-详情页',
     path: '/entering_edit/:key/:id',
     Com: React.lazy(() => import('../B_enterTibet/B3entering/B3edit'))
   },
   {
     id: 22,
-    name: '藏品入藏-新增、编辑、审批/查看',
+    name: '藏品入藏-详情页',
     path: '/enterTibet_edit/:key/:id',
     Com: React.lazy(() => import('../B_enterTibet/B4enterTibet/B4edit'))
   },
@@ -424,25 +427,25 @@ export const routerSon: RouterTypeRow[] = [
   // -------------资源使用-----------------
   {
     id: 20,
-    name: '资源使用-新增/编辑/审批/查看',
+    name: '资源使用-详情页',
     path: '/wealth_edit/:key/:id',
     Com: React.lazy(() => import('../C_goodsManage/C21wealth/C21edit'))
   },
   {
     id: 23,
-    name: '人员出入库-新增/编辑/审批/查看',
+    name: '人员出入库-详情页',
     path: '/staff_edit/:key/:id',
     Com: React.lazy(() => import('../D_storeManage/D3staff/D3edit'))
   },
   {
     id: 24,
-    name: '藏品盘点-新增/编辑/审批/查看',
+    name: '藏品盘点-详情页',
     path: '/check_edit/:key/:id',
     Com: React.lazy(() => import('../D_storeManage/D7check/D7edit'))
   },
   {
     id: 25,
-    name: '藏品移库-新增、编辑、审批/查看',
+    name: '藏品移库-详情页',
     path: '/moveStor_edit/:key/:id',
     Com: React.lazy(() => import('../D_storeManage/D5moveStor/D5edit'))
   }

+ 7 - 0
src/pages/Layout/index.tsx

@@ -26,6 +26,7 @@ import { baseURL, isDing } from '@/utils/http'
 import baseTouXiangImg from '@/assets/img/user.png'
 import { Z5_APIgetInfo } from '@/store/action/Z5role'
 import { getUserInfoByIdAPI } from '@/store/action/Z6user'
+import { maiDianFu } from '@/components/ZmaiDian'
 
 function Layout() {
   // 获取最新用户信息 存到本地
@@ -90,6 +91,11 @@ function Layout() {
   const location = useLocation()
   const [path, setPath] = useState('')
 
+  // 处理埋点信息
+  useEffect(() => {
+    if (path) maiDianFu(path)
+  }, [path])
+
   const sroolRef = useRef<HTMLDivElement>(null)
   const sroolTimeRef = useRef(-1)
 
@@ -260,6 +266,7 @@ function Layout() {
     const res: any = await passWordEditAPI(obj)
     if (res.code === 0) {
       MessageFu.success('修改成功!')
+      store.dispatch({ type: 'layout/passEditShow', payload: false })
       loginExit()
     }
   }

+ 2 - 0
src/types/declaration.d.ts

@@ -8,3 +8,5 @@ declare module 'js-export-excel'
 declare module 'braft-utils'
 declare const isDingTemp: boolean
 declare const baseUrlTempOne: string
+// 埋点信息
+declare const aplus_queue: any[]