Browse Source

feat: 日志上报添加曲子业务id和partIndex

TIANYONG 2 weeks ago
parent
commit
e5c460e712

+ 7 - 1
src/hooks/errorLog/index.ts

@@ -1,4 +1,6 @@
 import { uploadErrorLog } from "./uploadLog";
+import state from "/src/state";
+import { getQuery } from "/src/utils/queryString";
 
 type uploadType = {
   clientType?: string;
@@ -12,6 +14,8 @@ type uploadType = {
   deviceVersion?: string | null
 }
 
+const query: any = getQuery();
+
 /**
  * 页面有报错时上传错误日志
  * @params
@@ -26,7 +30,9 @@ export default function useErrorLog() {
     };filename: ${event.filename || ''};fileUrl: ${
       window.location.href
     };reason: ${event.reason?.message || ''};
-    stack: ${event.reason?.stack || ''};`;
+    stack: ${event.reason?.stack || ''};
+    bizId: ${state.examSongId || query.id || ''};
+    partIndex: ${query["part-index"] || state.partIndex || 0}`;
     uploadErrorLog(contentError)
   };
   /**

+ 2 - 2
src/hooks/errorLog/uploadLog.ts

@@ -22,14 +22,14 @@ export const uploadErrorLog = async (contentError: string) => {
 	  }
 	console.log('errorLog','错误',event)
 	try {
-	console.log(window.location.hash, 'errorLog')
+	console.log(window.location.hash, 'errorLog', storeData)
 
 	const params = [
 		{
 		...defaultParams,
 		appKey: state.isCbsView ? 'CBS' : 'KT',
 		// clientType: state.systemType === 'teacher' ? 'TEACHER' : state.systemType === 'student' ? 'STUDENT' : 'BACKEND',
-		clientType: storeData.isApp ? 'STUDENT' : 'BACKEND',
+		clientType: storeData.isApp ? 'STUDENT' : storeData.user?.clientType ? storeData.user?.clientType : 'BACKEND',
 		content: contentError,
 		exceptionTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
 		phone: storeData.user?.phone,

+ 2 - 2
src/page-instrument/view-detail/index.tsx

@@ -183,7 +183,7 @@ export default defineComponent({
         await getMusicDetail(id);
       } catch (err: any) {
         console.error(err);
-        const contentError = `reason: ${err?.message || ''};stack: ${err?.stack || ''};`;
+        const contentError = `reason: ${err?.message || ''};stack: ${err?.stack || ''};bizId: ${state.examSongId || query.id || ''};partIndex: ${query["part-index"] || state.partIndex || 0};`;
         uploadErrorLog(contentError)
         state.isLoading = false;
         isEmptyMusicShow.value = true
@@ -362,7 +362,7 @@ export default defineComponent({
         handleRendered(osmd)
       }catch(err:any){
         console.log(err, "err")
-        const contentError = `reason: ${err?.message || ''};stack: ${err?.stack || ''};`;
+        const contentError = `reason: ${err?.message || ''};stack: ${err?.stack || ''};bizId: ${state.examSongId || query.id || ''};partIndex: ${query["part-index"] || state.partIndex || 0};`;
         uploadErrorLog(contentError)
         // 需要向外面(iframe)派发计时器数据的时候触发
         if(query.isbeatTimes){

+ 2 - 2
vite.config.ts

@@ -76,8 +76,8 @@ export default defineConfig({
         // target: "https://kt.colexiu.com",
         // target: "https://test.lexiaoya.cn",
         // target: "https://kt.colexiu.com",
-        target: "https://test.resource.colexiu.com", // 内容平台开发环境,内容平台开发,需在url链接上加上isCbs=true
-        // target: "https://test.kt.colexiu.com",
+        // target: "https://test.resource.colexiu.com", // 内容平台开发环境,内容平台开发,需在url链接上加上isCbs=true
+        target: "https://test.kt.colexiu.com",
         // target: "https://mec.colexiu.com",
         changeOrigin: true,
         rewrite: (path) => path.replace(/^\/instrument/, ""),