Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_JJ_F
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
middleLayer_for_JJ_F
Commits
e37e31d3
Commit
e37e31d3
authored
Jul 15, 2025
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: debug
parent
26ed7356
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
35 deletions
+40
-35
middleLayer.ts
assets/middleLayer_for_JJ_F/script/middleLayer.ts
+23
-5
studyRecord.js
assets/middleLayer_for_JJ_F/script/studyRecord.js
+17
-30
No files found.
assets/middleLayer_for_JJ_F/script/middleLayer.ts
View file @
e37e31d3
import
{
middleLayerBase
}
from
"
./middleLayerBase
"
;
import
{
middleLayerBase
}
from
"
./middleLayerBase
"
;
import
{
initAir
}
from
'
./air
'
;
import
{
initAir
}
from
'
./air
'
;
// @ts-ignore
import
StudyRecord
from
'
./studyRecord
'
;
import
StudyRecord
from
'
./studyRecord
'
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
@@ -591,10 +592,19 @@ export default class NewClass extends middleLayerBase {
...
@@ -591,10 +592,19 @@ export default class NewClass extends middleLayerBase {
studyRecord
:
StudyRecord
;
studyRecord
:
StudyRecord
;
studyRecordModel
;
studyRecordModel
;
initStudyRecord
(
study_record
)
{
initStudyRecord
(
study_record
)
{
try
{
console
.
log
(
'
initStudyRecord study_record:
'
,
study_record
);
console
.
log
(
'
initStudyRecord study_record:
'
,
study_record
);
this
.
studyRecordModel
=
study_record
;
console
.
log
(
'
StudyRecord constructor:
'
,
StudyRecord
);
this
.
studyRecord
=
new
StudyRecord
();
console
.
log
(
'
StudyRecord type:
'
,
typeof
StudyRecord
);
this
.
studyRecordModel
=
study_record
;
this
.
studyRecord
=
new
StudyRecord
();
console
.
log
(
'
StudyRecord instance created:
'
,
this
.
studyRecord
);
}
catch
(
error
)
{
console
.
error
(
'
Error creating StudyRecord instance:
'
,
error
);
console
.
error
(
'
StudyRecord constructor:
'
,
StudyRecord
);
}
}
}
setSRRecord
(
key
,
value
)
{
setSRRecord
(
key
,
value
)
{
...
@@ -628,7 +638,15 @@ export default class NewClass extends middleLayerBase {
...
@@ -628,7 +638,15 @@ export default class NewClass extends middleLayerBase {
reportData
()
{
reportData
()
{
if
(
this
.
studyRecord
)
{
if
(
this
.
studyRecord
)
{
this
.
studyRecord
.
reportData
(
this
.
studyRecordModel
);
const
reportData
=
this
.
studyRecord
.
reportData
(
this
.
studyRecordModel
);
// 在这里处理网络请求
this
.
callNetworkApiPostNew
(
`api/insights/v1/study-analysis`
,
{
...
this
.
studyRecordModel
,
recordData
:
reportData
},
res
=>
{
console
.
log
(
'
reportData => res:
'
,
res
);
});
}
}
}
}
...
...
assets/middleLayer_for_JJ_F/script/studyRecord.js
View file @
e37e31d3
...
@@ -321,37 +321,24 @@ class StudyRecord {
...
@@ -321,37 +321,24 @@ class StudyRecord {
// ==================== 数据上报方法 ====================
// ==================== 数据上报方法 ====================
reportData
(
studyRecordModel
)
{
reportData
(
studyRecordModel
)
{
// 注意:这个方法需要在使用时传入正确的上下文
// 因为 this.callNetworkApiPostNew 可能不存在于 StudyRecord 类中
this
.
callNetworkApiPostNew
(
`api/insights/v1/study-analysis`
,
studyRecordModel
,
res
=>
{
console
.
log
(
'
reportData called with:
'
,
studyRecordModel
);
console
.
log
(
'
reportData => res:
'
,
res
);
// callback && callback(res);
});
// this.studyRecordModel.recordData = jsonEncode({'questions': _questionScores});
// 如果需要网络请求,应该在调用方处理
// 这里只处理数据准备
// console.log(this.studyRecordModel.toJson());
const
reportData
=
{
audioScores
:
this
.
getAllAudioKeyData
(),
// const score = getAverageQuestionScore().toInt();
totalVideoDuration
:
this
.
getTotalVideoDuration
(),
totalAudioDuration
:
this
.
getTotalAudioDuration
(),
// StudyRecordScore.showScoreDismissible(context, score);
totalQuestions
:
this
.
totalQuestions
,
questionResults
:
this
.
getAllQuestionResults
(),
// DioResponse result = await DioUtil().request(Api.studyAnalysis,
averageScore
:
this
.
getAverageScore
()
// method: DioMethod.post,
};
// service: DioService.insights,
// cancelToken: null,
console
.
log
(
'
Prepared report data:
'
,
reportData
);
// data: this.studyRecordModel.toJson());
return
reportData
;
// if (result.statusCode == 200) {
// console.log('上传成功');
// // GetStorage().write('canvasReportData', jsonString);
// } else {
// console.log('上传失败');
// }
}
}
}
}
export
default
StudyRecord
;
export
default
StudyRecord
;
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment