Commit 705feebd authored by 黄奎's avatar 黄奎

页面修改

parent 03e6fd44
......@@ -29,20 +29,30 @@ var uploadMsg = {
/**
* 自定义上传文件
*/
export function UploadSelfFile(path, file, callback) {
export function UploadSelfFile(path, file, isTrans, callback) {
var newPath = '/Upload/' + path + "/";
let url = uploadMsg.uploadUrl + "/Upload?filePath=" + newPath
let url = uploadMsg.uploadUrl + "/Upload?filePath=" + newPath;
if (isTrans && isTrans == 1) {
url += "&isTrans=1"
}
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 tempArray = [];
if (jsonObj.OtherFile && jsonObj.OtherFile.length > 0) {
jsonObj.OtherFile.forEach(item => {
tempArray.push(uploadMsg.imgDomain + item);
})
}
var uploadResult = {
resultCode: 1,
FileName: file.name,
FileUrl: uploadMsg.imgDomain + jsonObj.FilePath,
VideoCoverImg: uploadMsg.imgDomain + jsonObj.VideoCoverImg
VideoCoverImg: uploadMsg.imgDomain + jsonObj.VideoCoverImg,
ExtFile: tempArray
}
callback(uploadResult);
}
......@@ -64,7 +74,7 @@ export function queryAreaTree(data) {
/**
* 获取省市区列表
*/
*/
export function queryAreaList(data) {
return request({
url: '/Public/GetAreaList',
......@@ -72,3 +82,12 @@ export function queryAreaList(data) {
data
})
}
/**
* 获取文件扩展名
*/
export function getFileExt(filename) {
var index = filename.lastIndexOf(".");
var suffix = filename.substr(index + 1);
return suffix
}
......@@ -2,7 +2,7 @@
<q-dialog v-model="persistent" persistent transition-show="scale" transition-hide="scale">
<q-card style="width: 800px;max-width:900px;">
<q-card-section>
<div class="text-h6">{{objOption.MenuId==0?'新增教案信息':'修改教案信息'}}</div>
<div class="text-h6">{{objOption.PlanId==0?'新增教案信息':'修改教案信息'}}</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="text-caption q-mb-lg q-px-md text-grey-6">教案信息</div>
......@@ -45,6 +45,10 @@
extEditor
},
props: {
CourseId: {
type: String,
default: "0"
},
saveObj: {
type: Object,
default: null
......@@ -69,7 +73,6 @@
},
optionTitle: "",
saveCourseLoading: false,
TreeCategoryList: [], //课程分类树形列表
}
},
mounted() {
......@@ -123,7 +126,8 @@
},
//保存菜单
saveCourse() {
this.saveCourseLoading = true
this.objOption.CourseId = this.CourseId;
this.saveCourseLoading = true;
saveTeachPlanInfo(this.objOption).then(res => {
this.saveCourseLoading = false
this.$q.notify({
......
<template>
<q-dialog v-model="persistent" persistent transition-show="scale" transition-hide="scale">
<q-card style="width: 800px;max-width:900px;">
<q-card-section>
<div class="text-h6">上传教案信息</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="text-caption q-mb-lg q-px-md text-grey-6">教案信息</div>
<div class="row wrap">
<q-uploader style="display: inline-block;max-height: 320px;max-width: 100%; background-repeat:no-repeat"
max-files="1" hide-upload-btn label="教案" :max-file-size="10*1024*1024"
accept=".doc,.docx,.ppt,.pptx,.xls,.xlsx,.pdf" auto-upload :factory="uploadFile" no-thumbnails>
</q-uploader>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" color="dark" style="font-weight:400 !important" @click="closeCourseForm" />
<q-btn label="立即提交" color="accent q-px-md" style="font-weight:400 !important" :loading="saveCourseLoading"
@click="saveCourse" />
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script>
import {
saveTeachPlanInfo
} from '../../api/course/index'
import {
UploadSelfFile,
getFileExt
} from '../../api/common/common'
export default {
components: {
},
props: {
CourseId: {
type: String,
default: "0"
},
saveObj: {
type: Object,
default: null
}
},
data() {
return {
persistent: true,
objOption: {
PlanId: 0, //教案编号
CourseId: 0, //课程编辑
PlanName: "", //教案名称
ClassBefore: "", //课前
ClassIn: "", //课中
ClassAfter: "", //课后
ParentPlanId: 0, //父级节点编号
SourceUrl: "", //源文件路径
PlanFileExtension: "", //文件后缀名
PlanNodeType: 0, //节点类型(0-文件,1-文件夹)
ExtUrl: "", //上传生成文件路径
Remark: "", //备注
},
optionTitle: "",
saveCourseLoading: false,
}
},
mounted() {
this.initObj()
},
methods: {
uploadFile(files) {
UploadSelfFile('assistIcon', files[0], 1, res => {
if (res.resultCode == 1) {
this.objOption.PlanName = res.FileName;
this.objOption.PlanFileExtension = getFileExt(res.FileName);
this.objOption.SourceUrl = res.FileUrl;
if (res.ExtFile && res.ExtFile.length > 0) {
this.objOption.ExtUrl = res.ExtFile.toString();
}
}
})
},
//初始化表单
initObj() {
this.optionTitle = "上传教案"
},
//关闭弹窗
closeCourseForm() {
this.$emit('close')
this.persistent = false
},
//保存菜单
saveCourse() {
this.objOption.CourseId = this.CourseId;
this.saveCourseLoading = true;
saveTeachPlanInfo(this.objOption).then(res => {
this.saveCourseLoading = false
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据保存成功!',
position: 'top'
})
this.$emit("success")
this.closeSaveForm()
}).catch(() => {
this.saveCourseLoading = false
})
}
},
}
</script>
......@@ -54,7 +54,7 @@
</q-td>
</template>
</q-table>
<course-form v-if="isShowCourseForm" :save-obj="courseObjOption" @close="closeMenuSaveForm"
<course-form v-if="isShowCourseForm" :save-obj="courseObjOption" @close="closeMenuSaveForm"
@success="refreshPage">
</course-form>
</div>
......
......@@ -13,7 +13,7 @@
</q-item>
<q-item clickable v-close-popup>
<q-item-section>
<q-item-label>上传教案</q-item-label>
<q-item-label @click="IsShowTeachUploadForm=true">上传教案</q-item-label>
</q-item-section>
</q-item>
</q-list>
......@@ -53,9 +53,12 @@
</q-td>
</template>
</q-table>
<teachplan-form v-if="IsShowTeachForm" :save-obj="teachPlanObj" @close="closeTeachSaveForm"
<teachplan-form v-if="IsShowTeachForm" :CourseId="CourseId" :save-obj="teachPlanObj" @close="closeTeachSaveForm"
@success="refreshPage">
</teachplan-form>
<teachupload-form v-if="IsShowTeachUploadForm" :CourseId="CourseId" @close="closeTeachUploadForm"
@success="refreshPage">
</teachupload-form>
</div>
</div>
</template>
......@@ -66,6 +69,7 @@
removeTeachPlanInfo
} from '../../api/course/index'
import teachplanForm from '../../components/course/teachplan-form'
import teachuploadForm from '../../components/course/teachupload-form'
export default {
meta: {
......@@ -73,6 +77,7 @@
},
components: {
teachplanForm,
teachuploadForm
},
data() {
return {
......@@ -125,6 +130,7 @@
CourseId: 0,
pageCount: 0,
IsShowTeachForm: false,
IsShowTeachUploadForm: false,
teachPlanObj: null,
}
},
......@@ -178,6 +184,9 @@
closeTeachSaveForm() {
this.IsShowTeachForm = false
},
closeTeachUploadForm() {
this.IsShowTeachUploadForm = false;
},
//删除教案
deleteTeach(obj) {
var that = this;
......
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