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
3345f1d6
Commit
3345f1d6
authored
Oct 15, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
0f53c51a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
86 deletions
+107
-86
common.js
src/api/common/common.js
+95
-69
course-form.vue
src/components/course/course-form.vue
+12
-17
No files found.
src/api/common/common.js
View file @
3345f1d6
...
...
@@ -4,70 +4,72 @@ import request from '../../utils/request'
* 获取富文本编辑器Toolbar
*/
export
function
getToolBarConfig
()
{
return
[
[{
label
:
'对齐'
,
icon
:
this
.
$q
.
iconSet
.
editor
.
align
,
fixedLabel
:
true
,
list
:
'only-icons'
,
options
:
[
'left'
,
'center'
,
'right'
,
'justify'
]
}],
[
'bold'
,
'italic'
,
'strike'
,
'underline'
,
'subscript'
,
'superscript'
],
[{
label
:
'格式'
,
icon
:
this
.
$q
.
iconSet
.
editor
.
formatting
,
list
:
'no-icons'
,
fixedLabel
:
true
,
fixedIcon
:
true
,
options
:
[
'p'
,
'h1'
,
'h2'
,
'h3'
,
'h4'
,
'h5'
,
'h6'
,
'code'
]
},
{
label
:
'字号'
,
icon
:
this
.
$q
.
iconSet
.
editor
.
fontSize
,
fixedLabel
:
true
,
fixedIcon
:
true
,
list
:
'no-icons'
,
options
:
[
'size-1'
,
'size-2'
,
'size-3'
,
'size-4'
,
'size-5'
,
'size-6'
,
'size-7'
]
},
{
label
:
'字体'
,
icon
:
this
.
$q
.
iconSet
.
editor
.
font
,
fixedLabel
:
true
,
fixedIcon
:
true
,
list
:
'no-icons'
,
options
:
[
'default_font'
,
'arial'
,
'arial_black'
,
'comic_sans'
,
'courier_new'
,
'impact'
,
'lucida_grande'
,
'times_new_roman'
,
'verdana'
]
},
'removeFormat'
],
[
'ordered'
,
'outdent'
,
'indent'
],
];
// return [
// [{
// label: '对齐',
// icon: this.$q.iconSet.editor.align,
// fixedLabel: true,
// list: 'only-icons',
// options: ['left', 'center', 'right', 'justify']
// }],
// ['bold', 'italic', 'strike', 'underline', 'subscript', 'superscript'],
// [{
// label: '格式',
// icon: this.$q.iconSet.editor.formatting,
// list: 'no-icons',
// fixedLabel: true,
// fixedIcon: true,
// options: [
// 'p',
// 'h1',
// 'h2',
// 'h3',
// 'h4',
// 'h5',
// 'h6',
// 'code'
// ]
// },
// {
// label: '字号',
// icon: this.$q.iconSet.editor.fontSize,
// fixedLabel: true,
// fixedIcon: true,
// list: 'no-icons',
// options: [
// 'size-1',
// 'size-2',
// 'size-3',
// 'size-4',
// 'size-5',
// 'size-6',
// 'size-7'
// ]
// },
// {
// label: '字体',
// icon: this.$q.iconSet.editor.font,
// fixedLabel: true,
// fixedIcon: true,
// list: 'no-icons',
// options: [
// 'default_font',
// 'arial',
// 'arial_black',
// 'comic_sans',
// 'courier_new',
// 'impact',
// 'lucida_grande',
// 'times_new_roman',
// 'verdana'
// ]
// },
// 'removeFormat'
// ],
// ['ordered', 'outdent', 'indent'],
// ];
return
[];
}
/**
...
...
@@ -89,10 +91,34 @@ export function getFontConfig() {
/**
* 文件上传配置
*/
export
function
uploadConfig
()
{
var
uploadMsg
=
{
imgDomain
:
"http://imgfile.oytour.com"
,
action
:
"http://upload.oytour.com/Upload?filePath="
,
var
uploadMsg
=
{
//http://imgfile.oytour.com http://192.168.1.214:8130
//http://upload.oytour.com http://192.168.1.214:8120
imgDomain
:
"http://192.168.1.214:8130"
,
uploadUrl
:
"http://192.168.1.214:8120"
,
}
/**
* 自定义上传文件
*/
export
function
UploadSelfFile
(
path
,
file
,
callback
)
{
var
newPath
=
'/Upload/'
+
path
+
"/"
;
let
url
=
uploadMsg
.
uploadUrl
+
"/Upload?filePath="
+
newPath
let
formData
=
new
FormData
()
formData
.
append
(
'myfile'
,
file
)
let
xhr
=
new
XMLHttpRequest
()
xhr
.
onload
=
function
()
{
var
jsonObj
=
JSON
.
parse
(
xhr
.
responseText
);
if
(
jsonObj
.
StatusCode
==
1
&&
callback
)
{
var
uploadResult
=
{
resultCode
:
1
,
FileName
:
file
.
name
,
FileUrl
:
uploadMsg
.
imgDomain
+
jsonObj
.
FilePath
,
VideoCoverImg
:
uploadMsg
.
imgDomain
+
jsonObj
.
VideoCoverImg
}
callback
(
uploadResult
);
}
}
return
uploadMsg
;
xhr
.
open
(
'post'
,
url
,
true
)
xhr
.
send
(
formData
)
}
src/components/course/course-form.vue
View file @
3345f1d6
...
...
@@ -15,8 +15,9 @@
tipText=
"课程分类"
@
getChild=
"getChild"
></selectTree>
</div>
<div
class=
"col-6 q-pb-lg upload-assiatant-box"
>
<q-uploader
flat
@
uploaded=
"uploadSuccess"
hide-upload-btn
max-files=
"1"
@
rejected=
"onRejected"
label=
"助教头像"
:max-file-size=
"512*1024"
accept=
".jpg, image/*"
auto-upload
:url=
"action"
>
<q-uploader
flat
hide-upload-btn
max-files=
"1"
label=
"课程封面"
:max-file-size=
"512*1024"
accept=
".jpg, image/*"
:factory=
"uploadFile"
auto-upload
>
<q-img
v-if=
"objOption.CoverImg"
:src=
"objOption.CoverImg"
/>
</q-uploader>
</div>
</div>
...
...
@@ -43,7 +44,9 @@
}
from
'../../api/course/index'
import
{
getToolBarConfig
,
getFontConfig
getFontConfig
,
uploadConfig
,
UploadSelfFile
}
from
'../../api/common/common'
import
selectTree
from
'../common/select-tree'
export
default
{
...
...
@@ -58,8 +61,6 @@
},
data
()
{
return
{
imgDomain
:
"http://imgfile.oytour.com"
,
action
:
"http://upload.oytour.com/Upload?filePath="
+
encodeURIComponent
(
'/course/'
),
persistent
:
true
,
objOption
:
{
CourseId
:
0
,
//课程编号
...
...
@@ -73,7 +74,7 @@
saveCourseLoading
:
false
,
TreeCategoryList
:
[],
//课程分类树形列表
toolbar
:
[],
fonts
:
{}
fonts
:
{}
,
}
},
mounted
()
{
...
...
@@ -89,19 +90,13 @@
getChild
(
obj
)
{
this
.
objOption
.
CateId
=
obj
;
},
onRejected
(
rejectedEntri
es
)
{
this
.
$q
.
notify
(
{
type
:
'negative'
,
position
:
"top"
,
message
:
`文件验证失败,请重新上传`
uploadFile
(
fil
es
)
{
UploadSelfFile
(
'course'
,
files
[
0
],
res
=>
{
if
(
res
.
resultCode
==
1
)
{
this
.
objOption
.
CoverImg
=
res
.
FileUrl
;
}
})
},
uploadSuccess
(
info
)
{
if
(
info
.
xhr
.
status
==
'200'
)
{
let
res
=
JSON
.
parse
(
info
.
xhr
.
response
)
this
.
objOption
.
CoverImg
=
this
.
imgDomain
+
res
.
FilePath
}
},
getCategorytree
()
{
this
.
TreeCategoryList
=
[];
var
qMsg
=
{}
...
...
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