学习记录样式修改

develoop
edana 5 months ago
parent 3107411e0c
commit aa4de82bc7
  1. 18
      src/views/MyCourseStudy/learningProcess.vue
  2. 97
      src/views/courseResources/componse/resourceAdd.vue
  3. 18
      src/views/courseResources/index.vue

@ -155,6 +155,7 @@ const goToAnotherPage = (address) => {
<ul v-if="recordList.length > 0"> <ul v-if="recordList.length > 0">
<li v-for="record in recordList" :key="record.id" v-loading="loading"> <li v-for="record in recordList" :key="record.id" v-loading="loading">
<input <input
style="display: flex"
type="checkbox" type="checkbox"
:value="record.id" :value="record.id"
@change="toggleSelection(record.id)" @change="toggleSelection(record.id)"
@ -241,29 +242,30 @@ ul {
padding: 10; padding: 10;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: start; justify-content: start;
} }
li { li {
/* margin-bottom: 30px; */
transition: filter 0.3s; /* 添加过渡动画 */ transition: filter 0.3s; /* 添加过渡动画 */
flex: 0 0 20%; /* flex: 1 0 20%; */
width: calc(20% - 20px);
flex-direction: column; flex-direction: column;
align-items: center;
margin-bottom: 10px; text-align: center;
/* margin: 0 15px; */
padding: 10px; padding: 10px;
box-sizing: border-box; box-sizing: border-box;
transition: box-shadow 0.3s; transition: box-shadow 0.3s;
cursor: pointer; cursor: pointer;
align-items: center;
} }
li:hover { li:hover {
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
} }
.img { .img {
width: 100%; display: block;
height: 100%; width: 250px;
height: 250px;
} }
</style> </style>

@ -1,9 +1,11 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue' import { ref } from 'vue'
// import axios from 'axios'
import { CourseResourceControllerService } from '../../../../generated/services/CourseResourceControllerService' import { CourseResourceControllerService } from '../../../../generated/services/CourseResourceControllerService'
const props = defineProps(['dafulIndex']) const props = defineProps(['dafulIndex'])
import { QuillEditor } from '@vueup/vue-quill' import { QuillEditor } from '@vueup/vue-quill'
import '@vueup/vue-quill/dist/vue-quill.snow.css' import '@vueup/vue-quill/dist/vue-quill.snow.css'
import { ElMessage } from 'element-plus'
// //
const visibleDramwer = ref(false) const visibleDramwer = ref(false)
// //
@ -63,12 +65,17 @@ const selectOp = ref([
{ label: '文件', value: '5' }, { label: '文件', value: '5' },
{ label: '音频', value: '6' }, { label: '音频', value: '6' },
]) ])
const handleSel = () => {}
// const fileList = ref([])
import type { UploadProps, UploadUserFile } from 'element-plus' function clearFileList() {
fileList.value.length = 0
}
const handleSel = () => {
fileList.value.length = 0
}
const fileList = ref<UploadUserFile[]>([]) //
import type { UploadProps } from 'element-plus'
const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => { const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
console.log(uploadFile, uploadFiles) console.log(uploadFile, uploadFiles)
@ -77,6 +84,82 @@ const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
const handlePreview: UploadProps['onPreview'] = (file) => { const handlePreview: UploadProps['onPreview'] = (file) => {
console.log(file) console.log(file)
} }
const formRef = ref()
function isSubmit() {
formRef.value.validate((valid, fields) => {
if (valid) {
const params = {
name: formModel.value.name,
type: selectVal.value,
img: fileList.value[0]?.raw,
description: formModel.value.description,
}
console.log('根据参数:', params, '去调用接口???')
} else {
console.log('error submit!', fields)
}
})
}
// upd
const beforeAvatarUpload = (rawFile) => {
console.log('执行了')
switch (+selectVal.value) {
case 1:
if (rawFile.type !== 'application/vnd.ms-powerpoint') {
clearFileList()
ElMessage.error('必须是ppt文件!')
} else {
clearFileList()
fileList.value.push(rawFile)
}
break
case 2:
if (!rawFile.type.startsWith('image/')) {
clearFileList()
ElMessage.error('必须是??文件!')
} else {
clearFileList()
fileList.value.push(rawFile)
}
break
// case 3:
// if (false) {
// clearFileList()
// ElMessage.error('??')
// } else {
// clearFileList()
// fileList.value.push(rawFile)
// }
// break
// case 4:
// if (false) {
// clearFileList()
// ElMessage.error('??')
// } else {
// clearFileList()
// fileList.value.push(rawFile)
// }
// break
// case 5:
// if (false) {
// clearFileList()
// ElMessage.error('??')
// } else {
// clearFileList()
// fileList.value.push(rawFile)
// }
// break
// case 6:
// if (false) {
// clearFileList()
// ElMessage.error('??')
// } else {
// clearFileList()
// fileList.value.push(rawFile)
// }
// break
}
}
</script> </script>
<template> <template>
<el-drawer <el-drawer
@ -118,11 +201,13 @@ const handlePreview: UploadProps['onPreview'] = (file) => {
<el-form-item label="上传资源" prop="fileList"> <el-form-item label="上传资源" prop="fileList">
<el-upload <el-upload
v-model:file-list="fileList" v-model:file-list="fileList"
:limit="1"
class="upload-demo" class="upload-demo"
action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15" action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
:on-preview="handlePreview" :on-preview="handlePreview"
:on-remove="handleRemove" :on-remove="handleRemove"
list-type="picture" list-type="picture"
:before-upload="beforeAvatarUpload"
> >
<el-button type="primary">点击上传资源</el-button> <el-button type="primary">点击上传资源</el-button>
<template #tip> <template #tip>
@ -135,7 +220,7 @@ const handlePreview: UploadProps['onPreview'] = (file) => {
<el-form-item label="资源简介" prop="description"> <el-form-item label="资源简介" prop="description">
<div class="editor"> <div class="editor">
<quill-editor <quill-editor
v-model:description="formModel.description" v-model:content="formModel.description"
content-type="html" content-type="html"
theme="snow" theme="snow"
></quill-editor> ></quill-editor>
@ -143,7 +228,7 @@ const handlePreview: UploadProps['onPreview'] = (file) => {
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary">取消</el-button> <el-button type="primary">取消</el-button>
<el-button type="info">确定</el-button> <el-button type="info" @click="isSubmit">确定</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-drawer> </el-drawer>

@ -185,13 +185,13 @@ const onEditResource = (row) => {
<Edit /> <Edit />
</el-icon> </el-icon>
</div> </div>
<div <img
class="vedio" class="img"
@click="generateRecords(resource)" @click="generateRecords(resource)"
style="margin-top: 10px; margin-bottom: 10px" style="margin-top: 10px; margin-bottom: 10px"
> :src="resource.img"
<img :src="resource.img" /> />
</div>
<div class="box" style="display: flex; flex-direction: column"> <div class="box" style="display: flex; flex-direction: column">
<p style="margin-bottom: 10px">{{ resource.name }}</p> <p style="margin-bottom: 10px">{{ resource.name }}</p>
<p style="margin-top: 10px">{{ resource.description }}</p> <p style="margin-top: 10px">{{ resource.description }}</p>
@ -243,7 +243,6 @@ const onEditResource = (row) => {
} }
.body { .body {
background-color: #fff; background-color: #fff;
height: 100%;
} }
.top { .top {
margin-bottom: 20px; margin-bottom: 20px;
@ -267,7 +266,7 @@ ul {
} }
li { li {
transition: filter 0.3s; /* 添加过渡动画 */ transition: filter 0.3s; /* 添加过渡动画 */
flex: 0 0 20%; width: calc(25% - 25px);
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
margin-bottom: 10px; margin-bottom: 10px;
@ -296,4 +295,9 @@ li:hover {
.box p:hover { .box p:hover {
font-weight: bold; font-weight: bold;
} }
.img {
display: block;
width: 250px;
height: 250px;
}
</style> </style>

Loading…
Cancel
Save