Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
AI_BOOK_TOOL
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
AI_BOOK_TOOL
Commits
45e477f7
Commit
45e477f7
authored
Jul 27, 2025
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:
parent
d635f7f9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
12 deletions
+89
-12
index.html
form/index.html
+3
-3
index.js
form/index.js
+86
-9
No files found.
form/index.html
View file @
45e477f7
...
...
@@ -14,9 +14,9 @@
<!-- 引入组件库 -->
<script
src=
"//teach.cdn.ireadabc.com/h5template/h5-static-lib/js/element-ui/index.js"
></script>
<!-- 引入波形图组件 -->
<script
src=
"
https://unpkg.com/wavesurfer.js@2.0.4/dist
/wavesurfer.min.js"
></script>
<script
src=
"
https://unpkg.com/wavesurfer.js@2.0.4/dist/plugin
/wavesurfer.regions.min.js"
></script>
<script
src=
"
https://unpkg.com/wavesurfer.js@2.0.4/dist/plugin
/wavesurfer.timeline.min.js"
></script>
<script
src=
"
//teach.cdn.ireadabc.com/h5template/h5-static-lib/js
/wavesurfer.min.js"
></script>
<script
src=
"
//teach.cdn.ireadabc.com/h5template/h5-static-lib/js
/wavesurfer.regions.min.js"
></script>
<script
src=
"
//teach.cdn.ireadabc.com/h5template/h5-static-lib/js
/wavesurfer.timeline.min.js"
></script>
<style>
.text-editor
{
padding
:
20px
;
...
...
form/index.js
View file @
45e477f7
...
...
@@ -106,6 +106,8 @@ new Vue({
queueTasks
:
[],
// 新增:上传类型
uploadType
:
'
pdf
'
,
AI_SERVER_URL
:
'
https://stagingopensource.iteachabc.com
'
,
},
mounted
()
{
...
...
@@ -124,16 +126,91 @@ new Vue({
},
methods
:
{
async
tryAI
()
{
const
loading
=
this
.
$loading
({
// 公共的 POST 请求方法
async
postRequest
(
endpoint
,
data
,
options
=
{})
{
const
{
loadingText
=
'
请求中,请稍候...
'
,
successMessage
=
'
请求成功
'
,
errorMessage
=
'
请求失败
'
,
showLoading
=
true
,
showSuccessMessage
=
true
,
showErrorMessage
=
true
}
=
options
;
let
loading
=
null
;
if
(
showLoading
)
{
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'
AI 分析中,请稍候...
'
,
text
:
loadingText
,
spinner
:
'
el-icon-loading
'
,
background
:
'
rgba(0, 0, 0, 0.7)
'
});
await
callServerMethod
(
'
tryAI
'
,
{
prompt
:
'
请重新匹配
'
,
pageIndex
:
this
.
currentPageIndex
});
window
.
location
.
reload
();
}
try
{
const
result
=
await
new
Promise
((
resolve
,
reject
)
=>
{
$
.
ajax
({
url
:
this
.
AI_SERVER_URL
+
endpoint
,
type
:
'
POST
'
,
contentType
:
'
application/json
'
,
data
:
JSON
.
stringify
(
data
),
success
:
function
(
response
)
{
resolve
(
response
);
},
error
:
function
(
xhr
,
status
,
error
)
{
reject
(
new
Error
(
error
||
'
请求失败
'
));
}
});
});
if
(
result
.
code
===
200
)
{
if
(
showSuccessMessage
)
{
this
.
$message
.
success
(
successMessage
);
}
return
result
;
}
else
{
const
errorMsg
=
result
.
message
||
errorMessage
;
if
(
showErrorMessage
)
{
this
.
$message
.
error
(
errorMsg
);
}
throw
new
Error
(
errorMsg
);
}
}
catch
(
error
)
{
console
.
error
(
'
请求失败:
'
,
error
);
if
(
showErrorMessage
)
{
this
.
$message
.
error
(
error
.
message
||
errorMessage
);
}
throw
error
;
}
finally
{
if
(
loading
)
{
loading
.
close
();
}
}
},
async
tryAI
()
{
const
urlParams
=
new
URLSearchParams
(
window
.
location
.
search
);
const
coursewareId
=
urlParams
.
get
(
'
course_id
'
);
try
{
await
this
.
postRequest
(
'
/open/api/ai/dpe/v1/pagerepair
'
,
{
courseware_id
:
coursewareId
||
1
,
page_number
:
this
.
currentPageIndex
},
{
loadingText
:
'
AI 分析中,请稍候...
'
,
successMessage
:
'
AI 分析完成
'
,
errorMessage
:
'
AI 分析失败,请稍后重试
'
});
// 重新加载数据
await
this
.
loadDefaultData
();
}
catch
(
error
)
{
// 错误已在 postRequest 中处理
console
.
error
(
'
AI 分析失败:
'
,
error
);
}
},
// 心跳实时查询异步处理进度及信息
async
checkProcess
(
_data
)
{
...
...
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