Commit 3345f1d6 authored by 黄奎's avatar 黄奎

页面修改

parent 0f53c51a
......@@ -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)
}
......@@ -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(rejectedEntries) {
this.$q.notify({
type: 'negative',
position: "top",
message: `文件验证失败,请重新上传`
uploadFile(files) {
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 = {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment