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

页面修改

parent 0f53c51a
...@@ -4,70 +4,72 @@ import request from '../../utils/request' ...@@ -4,70 +4,72 @@ import request from '../../utils/request'
* 获取富文本编辑器Toolbar * 获取富文本编辑器Toolbar
*/ */
export function getToolBarConfig() { export function getToolBarConfig() {
return [ // return [
[{ // [{
label: '对齐', // label: '对齐',
icon: this.$q.iconSet.editor.align, // icon: this.$q.iconSet.editor.align,
fixedLabel: true, // fixedLabel: true,
list: 'only-icons', // list: 'only-icons',
options: ['left', 'center', 'right', 'justify'] // options: ['left', 'center', 'right', 'justify']
}], // }],
['bold', 'italic', 'strike', 'underline', 'subscript', 'superscript'], // ['bold', 'italic', 'strike', 'underline', 'subscript', 'superscript'],
[{ // [{
label: '格式', // label: '格式',
icon: this.$q.iconSet.editor.formatting, // icon: this.$q.iconSet.editor.formatting,
list: 'no-icons', // list: 'no-icons',
fixedLabel: true, // fixedLabel: true,
fixedIcon: true, // fixedIcon: true,
options: [ // options: [
'p', // 'p',
'h1', // 'h1',
'h2', // 'h2',
'h3', // 'h3',
'h4', // 'h4',
'h5', // 'h5',
'h6', // 'h6',
'code' // 'code'
] // ]
}, // },
{ // {
label: '字号', // label: '字号',
icon: this.$q.iconSet.editor.fontSize, // icon: this.$q.iconSet.editor.fontSize,
fixedLabel: true, // fixedLabel: true,
fixedIcon: true, // fixedIcon: true,
list: 'no-icons', // list: 'no-icons',
options: [ // options: [
'size-1', // 'size-1',
'size-2', // 'size-2',
'size-3', // 'size-3',
'size-4', // 'size-4',
'size-5', // 'size-5',
'size-6', // 'size-6',
'size-7' // 'size-7'
] // ]
}, // },
{ // {
label: '字体', // label: '字体',
icon: this.$q.iconSet.editor.font, // icon: this.$q.iconSet.editor.font,
fixedLabel: true, // fixedLabel: true,
fixedIcon: true, // fixedIcon: true,
list: 'no-icons', // list: 'no-icons',
options: [ // options: [
'default_font', // 'default_font',
'arial', // 'arial',
'arial_black', // 'arial_black',
'comic_sans', // 'comic_sans',
'courier_new', // 'courier_new',
'impact', // 'impact',
'lucida_grande', // 'lucida_grande',
'times_new_roman', // 'times_new_roman',
'verdana' // 'verdana'
] // ]
}, // },
'removeFormat' // 'removeFormat'
], // ],
['ordered', 'outdent', 'indent'], // ['ordered', 'outdent', 'indent'],
]; // ];
return [];
} }
/** /**
...@@ -89,10 +91,34 @@ export function getFontConfig() { ...@@ -89,10 +91,34 @@ export function getFontConfig() {
/** /**
* 文件上传配置 * 文件上传配置
*/ */
export function uploadConfig() { var uploadMsg = {
var uploadMsg = { //http://imgfile.oytour.com http://192.168.1.214:8130
imgDomain: "http://imgfile.oytour.com", //http://upload.oytour.com http://192.168.1.214:8120
action: "http://upload.oytour.com/Upload?filePath=", 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 @@ ...@@ -15,8 +15,9 @@
tipText="课程分类" @getChild="getChild"></selectTree> tipText="课程分类" @getChild="getChild"></selectTree>
</div> </div>
<div class="col-6 q-pb-lg upload-assiatant-box"> <div class="col-6 q-pb-lg upload-assiatant-box">
<q-uploader flat @uploaded="uploadSuccess" hide-upload-btn max-files="1" @rejected="onRejected" label="助教头像" <q-uploader flat hide-upload-btn max-files="1" label="课程封面" :max-file-size="512*1024" accept=".jpg, image/*"
:max-file-size="512*1024" accept=".jpg, image/*" auto-upload :url="action"> :factory="uploadFile" auto-upload>
<q-img v-if="objOption.CoverImg" :src="objOption.CoverImg" />
</q-uploader> </q-uploader>
</div> </div>
</div> </div>
...@@ -43,7 +44,9 @@ ...@@ -43,7 +44,9 @@
} from '../../api/course/index' } from '../../api/course/index'
import { import {
getToolBarConfig, getToolBarConfig,
getFontConfig getFontConfig,
uploadConfig,
UploadSelfFile
} from '../../api/common/common' } from '../../api/common/common'
import selectTree from '../common/select-tree' import selectTree from '../common/select-tree'
export default { export default {
...@@ -58,8 +61,6 @@ ...@@ -58,8 +61,6 @@
}, },
data() { data() {
return { return {
imgDomain: "http://imgfile.oytour.com",
action: "http://upload.oytour.com/Upload?filePath=" + encodeURIComponent('/course/'),
persistent: true, persistent: true,
objOption: { objOption: {
CourseId: 0, //课程编号 CourseId: 0, //课程编号
...@@ -73,7 +74,7 @@ ...@@ -73,7 +74,7 @@
saveCourseLoading: false, saveCourseLoading: false,
TreeCategoryList: [], //课程分类树形列表 TreeCategoryList: [], //课程分类树形列表
toolbar: [], toolbar: [],
fonts: {} fonts: {},
} }
}, },
mounted() { mounted() {
...@@ -89,19 +90,13 @@ ...@@ -89,19 +90,13 @@
getChild(obj) { getChild(obj) {
this.objOption.CateId = obj; this.objOption.CateId = obj;
}, },
onRejected(rejectedEntries) { uploadFile(files) {
this.$q.notify({ UploadSelfFile('course', files[0], res => {
type: 'negative', if (res.resultCode == 1) {
position: "top", this.objOption.CoverImg = res.FileUrl;
message: `文件验证失败,请重新上传` }
}) })
}, },
uploadSuccess(info) {
if (info.xhr.status == '200') {
let res = JSON.parse(info.xhr.response)
this.objOption.CoverImg = this.imgDomain + res.FilePath
}
},
getCategorytree() { getCategorytree() {
this.TreeCategoryList = []; this.TreeCategoryList = [];
var qMsg = {} 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