lijiaqi 4 months ago
commit 7a3188f3ab
  1. 30
      src/views/course/components/KnowledgeGraphUi/foldInfoUi.vue
  2. 16
      src/views/course/courseChapters.vue
  3. 26
      src/views/courseResources/componse/resourceAdd.vue
  4. 2
      src/views/courseResources/index.vue

@ -17,7 +17,7 @@
<div class="my-tag">本章资源</div>
</div>
<button class="my-button" @click.stop="emits('edit', item)" style="margin-right: 10px;">编辑</button>
<el-button type="danger" class="is-el-button" :loading="loading&&item.id===activeData.id" @click.stop="hanDel(item)" style="margin-right: 10px;">删除</el-button>
<my-btn :id="item.id" type="danger" class="is-el-button" style="margin-right: 10px;">删除</my-btn>
</div>
</template>
<template #default>
@ -40,8 +40,9 @@
<div class="my-tag" type="warning">{{ obj.totalclasshours }}学时</div>
</div>
<div class="tit-box-edit">
<button class="my-button" @click.stop="emits('edit', obj)" style="margin-right: 10px;">编辑</button>
<el-button type="danger" class="is-el-button" :loading="loading&&obj.id==activeData.id" my-type="error" @click.stop="hanDel(obj)">删除</el-button>
<button class="my-button" @click.stop="emits('edit', obj)"
style="margin-right: 10px;">编辑</button>
<my-btn :id="obj.id" type="danger" class="is-el-button" style="margin-right: 10px;">删除</my-btn>
</div>
</div>
</div>
@ -62,13 +63,24 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
defineProps(['foldInfoData','loading'])
import { ElButton } from 'element-plus';
import { ref, h, type SetupContext, withModifiers } from 'vue'
defineProps(['foldInfoData'])
const emits = defineEmits(['add', 'del', 'edit'])
const activeData = ref({id:undefined})
function hanDel(o:any){
activeData.value = o
emits('del', o.id)
const MyBtn = {
props: ['id'],
setup(props:{id:string}, context:SetupContext) {
const loading = ref(false)
const setLoading = (bool: boolean) => loading.value = bool
return ()=> h(ElButton, {
loading: loading.value,
onClick: withModifiers(function () {
emits('del', props.id,setLoading)
}, ['stop']),
...context.attrs,
}, context.slots)
}
}
</script>

@ -16,8 +16,7 @@
</div>
<div class="bottom">
<!-- 可折叠基本概念 -->
<fold-info-ui :foldInfoData="foldInfoData" @add="showHide = true" @edit="hanEdit" @del="flodDel"
:loading="foldDelLoading" />
<fold-info-ui :foldInfoData="foldInfoData" @add="showHide = true" @edit="hanEdit" @del="flodDel" />
<FoldAdd v-model:is-d="showHide" v-if="showHide" :data="foldInfoData" @submit="foldAddSubmit" />
<FoldEdit v-model:is-d="showHide1" v-if="showHide1" :editData="activeEditData" :data="foldInfoData"
@submit="foldEditSubmit" />
@ -108,6 +107,7 @@ function foldAddSubmit(data: any, updLoading: Function) {
.finally(() => updLoading(false))
}
//
<<<<<<< HEAD
const foldDelLoading = ref(false)
function flodDel(id: string) {
foldDelLoading.value = true
@ -118,6 +118,14 @@ function flodDel(id: string) {
type: 'success',
})
getFold()
=======
function flodDel(id: string,setLoading:Function) {
setLoading(true)
deleteSectionApi(id).then(() => {
ElMessage({
message: `删除成功`,
type: 'success'
>>>>>>> efc569df5dcaa0a473e7d75d75a5abe7e5d030d5
})
.catch(() => {
ElMessage({
@ -125,7 +133,11 @@ function flodDel(id: string) {
type: 'error',
})
})
<<<<<<< HEAD
.finally(() => (foldDelLoading.value = false))
=======
}).finally(() =>setLoading(false))
>>>>>>> efc569df5dcaa0a473e7d75d75a5abe7e5d030d5
}
//
const showHide1 = ref(false)

@ -3,6 +3,8 @@ import { ref } from 'vue'
const visibilerDrawer = ref(false)
import { ElMessage } from 'element-plus'
import { CourseResourceControllerService } from '../../../../generated/services/CourseResourceControllerService'
import tool from '@/utils/oss.js'
import { id } from 'element-plus/es/locales.mjs';
//
const defaultForm = {
description: '',
@ -13,13 +15,25 @@ const defaultForm = {
path: '',
}
const imageUrl = ref('')
const onSelectFile = (uploadFile) => {
// console.log(uploadFile)
//oss
const upload = async (option) =>{
//
imageUrl.value = URL.createObjectURL(uploadFile.raw)
//
formModel.value.img = uploadFile.raw
imageUrl.value = URL.createObjectURL(option.raw)
const res = await tool.oss.upload(option.raw);//
const url = "https://wenyu132.oss-cn-beijing.aliyuncs.com/" + res.name;//url
console.log(url);
//url
formModel.value.img = url
}
// const onSelectFile = (uploadFile) => {
// // console.log(uploadFile)
// //
// imageUrl.value = URL.createObjectURL(uploadFile.raw)
// //
// formModel.value.img = uploadFile.raw
// }
//
const formModel = ref({
@ -184,7 +198,7 @@ defineExpose({
:show-file-list="false"
:auto-upload="false"
:before-upload="beforeAvatarUpload"
:on-change="onSelectFile"
:on-change="upload"
>
<img v-if="imageUrl" :src="imageUrl" class="avatar" />
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>

@ -85,7 +85,7 @@ const param = ref({
download: '0',
content: '',
address: '/portal',
type: '1',
type: '4',
})
//
const generateRecords = async (rescource) => {

Loading…
Cancel
Save