Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
confucius
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
罗超
confucius
Commits
3f7ae99c
Commit
3f7ae99c
authored
Jan 07, 2022
by
zhengke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
e03677c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
91 deletions
+126
-91
index.js
src/api/course/index.js
+14
-2
words-form.vue
src/components/course/words-form.vue
+22
-29
chapterEditor.vue
src/pages/course/chapterEditor.vue
+90
-60
No files found.
src/api/course/index.js
View file @
3f7ae99c
...
@@ -722,9 +722,9 @@ export function SetTrialLesson(data){
...
@@ -722,9 +722,9 @@ export function SetTrialLesson(data){
* 根据课程编号和章节编号获取单词列表
* 根据课程编号和章节编号获取单词列表
* @param {JSON对象} data
* @param {JSON对象} data
*/
*/
export
function
GetCourseWords
List
(
data
){
export
function
GetCourseWords
Page
(
data
){
return
request
({
return
request
({
url
:
'/CourseWords/GetCourseWords
List
'
,
url
:
'/CourseWords/GetCourseWords
Page
'
,
method
:
'post'
,
method
:
'post'
,
data
data
})
})
...
@@ -754,4 +754,16 @@ export function SetCourseWords(data){
...
@@ -754,4 +754,16 @@ export function SetCourseWords(data){
})
})
}
}
/**
* 根据编号删除单词
* @param {JSON对象} data
*/
export
function
RemoveCourseWords
(
data
){
return
request
({
url
:
'/CourseWords/RemoveCourseWords'
,
method
:
'post'
,
data
})
}
src/components/course/words-form.vue
View file @
3f7ae99c
...
@@ -105,20 +105,19 @@
...
@@ -105,20 +105,19 @@
class=
"col-6 q-pr-lg q-pb-lg"
label=
"中文意思"
/>
class=
"col-6 q-pr-lg q-pb-lg"
label=
"中文意思"
/>
</div>
</div>
</div>
</div>
<div
class=
"row wrap"
>
<div
class=
"row wrap"
style=
"align-items:center"
>
<div
class=
"col-6"
>
<div
class=
"col-6"
>
<q-circular-progress
v-if=
"objOption.FileUrl"
:value=
"Minutes"
show-value
class=
"text-red q-ma-md"
size=
"70px"
:thickness=
"0.2"
color=
"light-blue"
track-color=
"grey-3"
@
click
.
stop=
"playVoice(objOption.FileUrl)"
>
<q-icon
name=
"volume_up"
class=
"q-mr-xs"
/>
<span
style=
"font-size: 11px;"
>
{{
Minutes
?
Minutes
.
toFixed
(
1
):
0
}}
</span>
</q-circular-progress>
<el-upload
class=
"avatar-uploader "
action=
""
:before-upload=
"uploadFile"
:show-file-list=
"false"
>
<el-upload
class=
"avatar-uploader "
action=
""
:before-upload=
"uploadFile"
:show-file-list=
"false"
>
<q-btn
color=
"accent"
size=
"sm"
class=
"q-mr-md"
icon=
"cloud_upload"
label=
"上传"
>
<q-btn
color=
"accent"
size=
"sm"
class=
"q-mr-md"
icon=
"cloud_upload"
label=
"上传"
>
</q-btn>
</q-btn>
</el-upload>
</el-upload>
</div>
</div>
<div
class=
"col-6"
>
<audio
v-if=
"objOption.FileUrl"
:src=
"objOption.FileUrl"
controls=
"controls"
>
您的浏览器不支持 audio 标签。
</audio>
<!--
<div>
{{
FileName
}}
</div>
-->
</div>
</div>
</div>
</q-card-section>
</q-card-section>
<q-separator
/>
<q-separator
/>
...
@@ -140,7 +139,6 @@
...
@@ -140,7 +139,6 @@
import
{
import
{
UploadSelfFile
UploadSelfFile
}
from
"../../api/common/common"
;
//上传图片
}
from
"../../api/common/common"
;
//上传图片
import
BenzAMRRecorder
from
'benz-amr-recorder'
export
default
{
export
default
{
components
:
{},
components
:
{},
props
:
{
props
:
{
...
@@ -169,7 +167,6 @@
...
@@ -169,7 +167,6 @@
},
},
optionTitle
:
""
,
optionTitle
:
""
,
saveWordLoading
:
false
,
saveWordLoading
:
false
,
Minutes
:
0
,
FileName
:
''
FileName
:
''
}
}
},
},
...
@@ -186,7 +183,6 @@
...
@@ -186,7 +183,6 @@
GetCourseWords
({
GetCourseWords
({
Id
:
this
.
saveObj
.
Id
Id
:
this
.
saveObj
.
Id
}).
then
(
res
=>
{
}).
then
(
res
=>
{
console
.
log
(
res
,
'数据'
);
if
(
res
.
Code
==
1
)
{
if
(
res
.
Code
==
1
)
{
var
tempDate
=
res
.
Data
;
var
tempDate
=
res
.
Data
;
this
.
objOption
.
Id
=
tempDate
.
Id
;
this
.
objOption
.
Id
=
tempDate
.
Id
;
...
@@ -224,26 +220,21 @@
...
@@ -224,26 +220,21 @@
// 文件类型进行判断
// 文件类型进行判断
let
types
=
[
'mp3'
,
'wma'
,
'wav'
,
'amr'
];
let
types
=
[
'mp3'
,
'wma'
,
'wav'
,
'amr'
];
const
isAudio
=
types
.
includes
(
files
.
type
);
const
isAudio
=
types
.
includes
(
files
.
type
);
const
isLt2M
=
files
.
size
/
1024
/
1024
<
2
;
if
(
files
&&
files
.
name
){
if
(
!
isLt2M
)
{
let
flieArr
=
files
.
name
.
split
(
"."
);
this
.
$q
.
notify
({
let
fileSuffix
=
flieArr
[
flieArr
.
length
-
1
];
type
:
'negative'
,
if
(
fileSuffix
!=
'mp3'
){
message
:
`上传文件大小不能超过 2MB!!`
,
this
.
$q
.
notify
({
position
:
'top'
type
:
'negative'
,
})
message
:
`请上传mp3格式文件!`
,
}
else
{
position
:
'top'
})
return
}
UploadSelfFile
(
'words'
,
files
,
res
=>
{
UploadSelfFile
(
'words'
,
files
,
res
=>
{
if
(
res
.
Code
==
1
)
{
if
(
res
.
Code
==
1
)
{
let
amr
=
new
BenzAMRRecorder
()
this
.
objOption
.
FileUrl
=
res
.
FileUrl
;
let
that
=
this
this
.
FileName
=
res
.
FileName
?
res
.
FileName
:
''
;
amr
.
initWithUrl
(
res
.
FileUrl
).
then
(
function
()
{
that
.
duration
=
amr
.
getDuration
();
that
.
objOption
.
FileUrl
=
res
.
FileUrl
;
that
.
FileName
=
res
.
FileName
?
res
.
FileName
:
''
;
that
.
Minutes
=
parseInt
(
that
.
duration
.
toFixed
());
}).
catch
((
e
)
=>
{
})
}
}
})
})
}
}
...
@@ -281,7 +272,9 @@
...
@@ -281,7 +272,9 @@
})
})
return
;
return
;
}
}
this
.
saveWordLoading
=
true
;
SetCourseWords
(
this
.
objOption
).
then
(
res
=>
{
SetCourseWords
(
this
.
objOption
).
then
(
res
=>
{
this
.
saveWordLoading
=
false
;
if
(
res
.
Code
==
1
)
{
if
(
res
.
Code
==
1
)
{
this
.
$q
.
notify
({
this
.
$q
.
notify
({
icon
:
'iconfont icon-chenggong'
,
icon
:
'iconfont icon-chenggong'
,
...
...
src/pages/course/chapterEditor.vue
View file @
3f7ae99c
...
@@ -84,19 +84,19 @@
...
@@ -84,19 +84,19 @@
<
/div
>
<
/div
>
<
div
class
=
"text-h6 q-mb-md"
>
单词列表
<
/div
>
<
div
class
=
"text-h6 q-mb-md"
>
单词列表
<
/div
>
<
div
class
=
"q-mb-md"
>
<
div
class
=
"q-mb-md"
>
<
q
-
table
:
pagination
=
"
page
Msg"
no
-
data
-
label
=
"暂无相关数据"
flat
<
q
-
table
:
pagination
=
"
word
Msg"
no
-
data
-
label
=
"暂无相关数据"
flat
class
=
"sticky-right-column-table sticky-column-table"
separator
=
"none"
:
data
=
"WordData"
:
columns
=
"columns"
class
=
"sticky-right-column-table sticky-column-table"
separator
=
"none"
:
data
=
"WordData"
row
-
key
=
"name"
>
:
columns
=
"columns"
row
-
key
=
"name"
>
<
template
v
-
slot
:
top
=
"props"
>
<
template
v
-
slot
:
top
=
"props"
>
<
q
-
space
/>
<
q
-
space
/>
<
div
class
=
"page-option"
>
<
div
class
=
"page-option"
>
<
q
-
btn
color
=
"accent"
size
=
"sm"
class
=
"q-mr-md"
icon
=
"add"
label
=
"新增单词"
@
click
=
"EditWord(null)"
/>
<
q
-
btn
color
=
"accent"
size
=
"sm"
class
=
"q-mr-md"
icon
=
"add"
label
=
"新增单词"
@
click
=
"EditWord(null)"
/>
<
/div
>
<
/div
>
<
/template
>
<
/template
>
<
!--
<
template
v
-
slot
:
bottom
>
<
template
v
-
slot
:
bottom
>
<
q
-
pagination
class
=
"full-width justify-end"
v
-
model
=
"msg.pageIndex"
color
=
"primary"
:
max
=
"pageCount
"
<
q
-
pagination
class
=
"full-width justify-end"
v
-
model
=
"wordMsg.PageIndex"
color
=
"primary
"
:
input
=
"true"
@
input
=
"changePage"
/>
:
max
=
"PageCount"
:
input
=
"true"
@
input
=
"changePage"
/>
<
/template> --
>
<
/template
>
<
template
v
-
slot
:
body
-
cell
-
Id
=
"props"
>
<
template
v
-
slot
:
body
-
cell
-
Id
=
"props"
>
<
q
-
td
:
props
=
"props"
>
<
q
-
td
:
props
=
"props"
>
<
div
>
<
div
>
...
@@ -142,7 +142,8 @@
...
@@ -142,7 +142,8 @@
queryCourseInfo
,
queryCourseInfo
,
deleteChapters
,
deleteChapters
,
setChaptersRate
,
setChaptersRate
,
GetCourseWordsList
GetCourseWordsPage
,
RemoveCourseWords
}
from
"../../api/course/index"
;
}
from
"../../api/course/index"
;
import
{
import
{
compareObject
compareObject
...
@@ -220,45 +221,50 @@
...
@@ -220,45 +221,50 @@
isShowChapter
:
false
,
//是否显示导入
isShowChapter
:
false
,
//是否显示导入
chapterObj
:
{
}
,
chapterObj
:
{
}
,
MyChapterNo
:
0
,
MyChapterNo
:
0
,
WordData
:[],
//单词数组
WordData
:
[],
//单词数组
pageMsg
:{
rowsPerPage
:
10000
}
,
columns
:
[{
columns
:
[{
name
:
'WordContent'
,
name
:
'WordContent'
,
required
:
true
,
required
:
true
,
label
:
'单词名'
,
label
:
'单词名'
,
align
:
'left'
,
align
:
'left'
,
field
:
'WordContent'
field
:
'WordContent'
}
,{
}
,
{
name
:
'WordType'
,
name
:
'WordType'
,
required
:
true
,
required
:
true
,
label
:
'单词类型'
,
label
:
'单词类型'
,
align
:
'left'
,
align
:
'left'
,
field
:
'WordType'
field
:
'WordType'
}
,{
}
,
{
name
:
'WordWrite'
,
name
:
'WordWrite'
,
required
:
true
,
required
:
true
,
label
:
'单词写法'
,
label
:
'单词写法'
,
align
:
'left'
,
align
:
'left'
,
field
:
'WordWrite'
field
:
'WordWrite'
}
,{
}
,
{
name
:
'ChineseMean'
,
name
:
'ChineseMean'
,
required
:
true
,
required
:
true
,
label
:
'中文意思'
,
label
:
'中文意思'
,
align
:
'left'
,
align
:
'left'
,
field
:
'ChineseMean'
field
:
'ChineseMean'
}
,{
}
,
{
name
:
'Id'
,
name
:
'Id'
,
label
:
'操作'
,
label
:
'操作'
,
field
:
'Id'
field
:
'Id'
}
],
}
],
wordObj
:{
}
,
wordObj
:
{
}
,
isShowWordForm
:
false
,
isShowWordForm
:
false
,
addObj
:{
addObj
:
{
CourseId
:
0
,
CourseId
:
0
,
ChapterId
:
0
ChapterId
:
0
}
}
,
wordMsg
:
{
CourseId
:
0
,
ChapterId
:
0
,
PageIndex
:
1
,
PageSize
:
15
,
rowsPerPage
:
15
}
,
PageCount
:
0
}
;
}
;
}
,
}
,
created
()
{
created
()
{
...
@@ -299,27 +305,51 @@
...
@@ -299,27 +305,51 @@
}
,
}
,
//导入成功获取所有
//导入成功获取所有
getAllWords
(
ChapterId
)
{
getAllWords
(
ChapterId
)
{
let
msg
=
{
this
.
wordMsg
.
CourseId
=
this
.
courseId
;
CourseId
:
this
.
courseId
,
this
.
wordMsg
.
ChapterId
=
ChapterId
;
ChapterId
:
ChapterId
GetCourseWordsPage
(
this
.
wordMsg
).
then
(
res
=>
{
}
GetCourseWordsList
(
msg
).
then
(
res
=>
{
console
.
log
(
res
,
'数据'
);
console
.
log
(
res
,
'数据'
);
if
(
res
.
Code
==
1
){
if
(
res
.
Code
==
1
)
{
this
.
WordData
=
res
.
Data
;
this
.
WordData
=
res
.
Data
.
PageData
;
this
.
PageCount
=
res
.
Data
.
PageCount
;
}
}
}
)
}
)
}
,
}
,
//删除单词
changePage
(
val
)
{
delWord
(
Id
)
{
this
.
wordMsg
.
PageIndex
=
val
;
this
.
getAllWords
();
}
,
}
,
//新增单词
//删除单词
addWord
(){
delWord
(
item
)
{
let
delMsg
=
{
Id
:
item
.
Id
}
;
this
.
$q
.
dialog
({
title
:
'提示信息'
,
message
:
'是否确定删除该单词?'
,
cancel
:
true
,
persistent
:
true
,
ok
:
"确定"
,
cancel
:
"取消"
,
}
).
onOk
(()
=>
{
RemoveCourseWords
(
delMsg
).
then
(
res
=>
{
if
(
res
.
Code
==
1
)
{
this
.
$q
.
notify
({
icon
:
'iconfont icon-chenggong'
,
color
:
'accent'
,
timeout
:
2000
,
message
:
'删除成功!'
,
position
:
'top'
}
)
this
.
getAllWords
();
}
}
)
}
).
onCancel
(()
=>
{
}
);
}
,
}
,
//新增单词
//新增单词
EditWord
(
obj
){
EditWord
(
obj
)
{
if
(
obj
)
{
if
(
obj
)
{
this
.
wordObj
=
obj
this
.
wordObj
=
obj
}
else
{
}
else
{
...
@@ -342,7 +372,7 @@
...
@@ -342,7 +372,7 @@
}
)
}
)
}
,
}
,
changeNode
(
data
,
node
,
ev
)
{
changeNode
(
data
,
node
,
ev
)
{
console
.
log
(
data
,
'点击了'
);
console
.
log
(
data
,
'点击了'
);
if
(
this
.
chapter
&&
this
.
chapter
.
ChapterId
>
0
)
{
if
(
this
.
chapter
&&
this
.
chapter
.
ChapterId
>
0
)
{
if
(
this
.
defauRateObj
.
Id
!=
0
)
{
if
(
this
.
defauRateObj
.
Id
!=
0
)
{
this
.
chapter
.
CourseRate
=
this
.
defauRateObj
.
Id
this
.
chapter
.
CourseRate
=
this
.
defauRateObj
.
Id
...
...
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