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

页面修改

parent 03e6fd44
...@@ -29,20 +29,30 @@ var uploadMsg = { ...@@ -29,20 +29,30 @@ var uploadMsg = {
/** /**
* 自定义上传文件 * 自定义上传文件
*/ */
export function UploadSelfFile(path, file, callback) { export function UploadSelfFile(path, file, isTrans, callback) {
var newPath = '/Upload/' + path + "/"; 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() let formData = new FormData()
formData.append('myfile', file) formData.append('myfile', file)
let xhr = new XMLHttpRequest() let xhr = new XMLHttpRequest()
xhr.onload = function () { xhr.onload = function () {
var jsonObj = JSON.parse(xhr.responseText); var jsonObj = JSON.parse(xhr.responseText);
if (jsonObj.StatusCode == 1 && callback) { 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 = { var uploadResult = {
resultCode: 1, resultCode: 1,
FileName: file.name, FileName: file.name,
FileUrl: uploadMsg.imgDomain + jsonObj.FilePath, FileUrl: uploadMsg.imgDomain + jsonObj.FilePath,
VideoCoverImg: uploadMsg.imgDomain + jsonObj.VideoCoverImg VideoCoverImg: uploadMsg.imgDomain + jsonObj.VideoCoverImg,
ExtFile: tempArray
} }
callback(uploadResult); callback(uploadResult);
} }
...@@ -64,7 +74,7 @@ export function queryAreaTree(data) { ...@@ -64,7 +74,7 @@ export function queryAreaTree(data) {
/** /**
* 获取省市区列表 * 获取省市区列表
*/ */
export function queryAreaList(data) { export function queryAreaList(data) {
return request({ return request({
url: '/Public/GetAreaList', url: '/Public/GetAreaList',
...@@ -72,3 +82,12 @@ export function queryAreaList(data) { ...@@ -72,3 +82,12 @@ export function queryAreaList(data) {
data data
}) })
} }
/**
* 获取文件扩展名
*/
export function getFileExt(filename) {
var index = filename.lastIndexOf(".");
var suffix = filename.substr(index + 1);
return suffix
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<q-dialog v-model="persistent" persistent transition-show="scale" transition-hide="scale"> <q-dialog v-model="persistent" persistent transition-show="scale" transition-hide="scale">
<q-card style="width: 800px;max-width:900px;"> <q-card style="width: 800px;max-width:900px;">
<q-card-section> <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>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh"> <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="text-caption q-mb-lg q-px-md text-grey-6">教案信息</div>
...@@ -45,6 +45,10 @@ ...@@ -45,6 +45,10 @@
extEditor extEditor
}, },
props: { props: {
CourseId: {
type: String,
default: "0"
},
saveObj: { saveObj: {
type: Object, type: Object,
default: null default: null
...@@ -69,7 +73,6 @@ ...@@ -69,7 +73,6 @@
}, },
optionTitle: "", optionTitle: "",
saveCourseLoading: false, saveCourseLoading: false,
TreeCategoryList: [], //课程分类树形列表
} }
}, },
mounted() { mounted() {
...@@ -123,7 +126,8 @@ ...@@ -123,7 +126,8 @@
}, },
//保存菜单 //保存菜单
saveCourse() { saveCourse() {
this.saveCourseLoading = true this.objOption.CourseId = this.CourseId;
this.saveCourseLoading = true;
saveTeachPlanInfo(this.objOption).then(res => { saveTeachPlanInfo(this.objOption).then(res => {
this.saveCourseLoading = false this.saveCourseLoading = false
this.$q.notify({ 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 @@ ...@@ -54,7 +54,7 @@
</q-td> </q-td>
</template> </template>
</q-table> </q-table>
<course-form v-if="isShowCourseForm" :save-obj="courseObjOption" @close="closeMenuSaveForm" <course-form v-if="isShowCourseForm" :save-obj="courseObjOption" @close="closeMenuSaveForm"
@success="refreshPage"> @success="refreshPage">
</course-form> </course-form>
</div> </div>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</q-item> </q-item>
<q-item clickable v-close-popup> <q-item clickable v-close-popup>
<q-item-section> <q-item-section>
<q-item-label>上传教案</q-item-label> <q-item-label @click="IsShowTeachUploadForm=true">上传教案</q-item-label>
</q-item-section> </q-item-section>
</q-item> </q-item>
</q-list> </q-list>
...@@ -53,9 +53,12 @@ ...@@ -53,9 +53,12 @@
</q-td> </q-td>
</template> </template>
</q-table> </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"> @success="refreshPage">
</teachplan-form> </teachplan-form>
<teachupload-form v-if="IsShowTeachUploadForm" :CourseId="CourseId" @close="closeTeachUploadForm"
@success="refreshPage">
</teachupload-form>
</div> </div>
</div> </div>
</template> </template>
...@@ -66,6 +69,7 @@ ...@@ -66,6 +69,7 @@
removeTeachPlanInfo removeTeachPlanInfo
} from '../../api/course/index' } from '../../api/course/index'
import teachplanForm from '../../components/course/teachplan-form' import teachplanForm from '../../components/course/teachplan-form'
import teachuploadForm from '../../components/course/teachupload-form'
export default { export default {
meta: { meta: {
...@@ -73,6 +77,7 @@ ...@@ -73,6 +77,7 @@
}, },
components: { components: {
teachplanForm, teachplanForm,
teachuploadForm
}, },
data() { data() {
return { return {
...@@ -125,6 +130,7 @@ ...@@ -125,6 +130,7 @@
CourseId: 0, CourseId: 0,
pageCount: 0, pageCount: 0,
IsShowTeachForm: false, IsShowTeachForm: false,
IsShowTeachUploadForm: false,
teachPlanObj: null, teachPlanObj: null,
} }
}, },
...@@ -178,6 +184,9 @@ ...@@ -178,6 +184,9 @@
closeTeachSaveForm() { closeTeachSaveForm() {
this.IsShowTeachForm = false this.IsShowTeachForm = false
}, },
closeTeachUploadForm() {
this.IsShowTeachUploadForm = false;
},
//删除教案 //删除教案
deleteTeach(obj) { deleteTeach(obj) {
var that = this; 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