浏览代码

Merge branch 'iteration-20250103'

lex-xin 3 周之前
父节点
当前提交
fae5724db4
共有 1 个文件被更改,包括 19 次插入0 次删除
  1. 19 0
      src/tenant/music/music-detail/new-index.tsx

+ 19 - 0
src/tenant/music/music-detail/new-index.tsx

@@ -51,6 +51,8 @@ import inactiveButtonIcon from './images/icon_checkbox_default.png'
 import staffDetafult from './images/staff-default.png'
 import firstDefault from './images/first-default.png'
 import fixedDefault from './images/fixed-default.png'
+import useErrorLog from '@/helpers/useErrorLog'
+import dayjs from 'dayjs'
 
 import Plyr from 'plyr'
 import 'plyr/dist/plyr.css'
@@ -61,6 +63,7 @@ import { svgtopng } from './formatSvgToImg'
 export default defineComponent({
   name: 'new-index',
   setup() {
+    const useErrorLogHook = useErrorLog()
     localStorage.setItem('behaviorId', getRandomKey())
     const router = useRouter()
     const route = useRoute()
@@ -243,6 +246,22 @@ export default defineComponent({
       // }
 
       window.addEventListener('message', showLoading)
+
+      // 判断是否有曲目编号 如果没有则记录日志
+      if(!route.query.id) {
+        const historyState = router.options.history.state
+        const contentError = `Error message: history url:${ historyState.back }、 current url${historyState.current};message: id is undefined;fileUrl: ${
+          window.location.href
+        }`;
+        useErrorLogHook.uploadSingleErrorLog({
+          appKey: 'KLX',
+          clientType: state.platformType,
+          phone: state.user.data?.phone,
+          userAgent: window.navigator.userAgent,
+          content: contentError,
+          exceptionTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
+        })
+      }
     })
     onUnmounted(() => {
       postMessage({