Compare commits

...

3 Commits

  1. 15
      generated/core/OpenAPI.ts
  2. 1
      package.json
  3. 7977
      pnpm-lock.yaml
  4. 0
      src/assets/icons/audio.png
  5. 0
      src/assets/icons/image.png
  6. 0
      src/assets/icons/test.png
  7. 0
      src/assets/icons/video.png
  8. BIN
      src/assets/images/PDF .png
  9. BIN
      src/assets/images/audio.png
  10. BIN
      src/assets/images/test.png
  11. BIN
      src/assets/images/video.png
  12. 2
      src/store/modules/user.ts
  13. 16
      src/views/MyCourseStudy/learningProcess.vue
  14. 162
      src/views/courseResources/componse/resourceAdd.vue
  15. 24
      src/views/courseResources/index.vue

@ -19,6 +19,7 @@ export type OpenAPIConfig = {
ENCODE_PATH?: ((path: string) => string) | undefined; ENCODE_PATH?: ((path: string) => string) | undefined;
}; };
export const OpenAPI: OpenAPIConfig = { export const OpenAPI: OpenAPIConfig = {
BASE: 'http://39.106.16.162:8080', BASE: 'http://39.106.16.162:8080',
VERSION: '1.0.0', VERSION: '1.0.0',
@ -30,3 +31,17 @@ export const OpenAPI: OpenAPIConfig = {
HEADERS: undefined, HEADERS: undefined,
ENCODE_PATH: undefined, ENCODE_PATH: undefined,
}; };
// BASE: 'http://39.106.16.162:8080',
BASE: 'http://127.0.0.1:8080/api',
VERSION: '1.0.0',
WITH_CREDENTIALS: false,
CREDENTIALS: 'include',
TOKEN: GET_TKOEN('TOKEN'),
USERNAME: undefined,
PASSWORD: undefined,
HEADERS: {
Authorization: 'Bearer ' + GET_TKOEN('TOKEN'),
},
ENCODE_PATH: undefined,
}

@ -21,6 +21,7 @@
"@element-plus/icons-vue": "^2.3.1", "@element-plus/icons-vue": "^2.3.1",
"@vueup/vue-quill": "^1.2.0", "@vueup/vue-quill": "^1.2.0",
"@vueuse/core": "^10.9.0", "@vueuse/core": "^10.9.0",
"ajax": "^0.0.4",
"ali-oss": "^6.20.0", "ali-oss": "^6.20.0",
"axios": "^1.6.8", "axios": "^1.6.8",
"d3": "^5.16.0", "d3": "^5.16.0",

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

@ -114,8 +114,6 @@ const useUserStore = defineStore(
this.userName = result.data.username this.userName = result.data.username
// this.avatar = result.data.checkUser.avatar // this.avatar = result.data.checkUser.avatar
// @ts-expect-error
this.routes = result.data.permissions this.routes = result.data.permissions
return { return {
result, result,

@ -12,8 +12,8 @@ const selectedIds = ref([])
const loading = ref(false) const loading = ref(false)
const showCheckbox = ref(false) const showCheckbox = ref(false)
const params = ref({ const params = ref({
pagesize: '15', // pagesize: '10',
pagenum: '1', // pagenum: '1',
userId: '1', userId: '1',
}) })
@ -28,6 +28,7 @@ const getrecordList = async () => {
params.value.pagenum, params.value.pagenum,
params.value.pagesize, params.value.pagesize,
) )
console.log(res)
recordList.value = res.data.records recordList.value = res.data.records
console.log(res) console.log(res)
// //
@ -206,7 +207,7 @@ const goToAnotherPage = (address) => {
<el-pagination <el-pagination
v-model:current-page="params.pagenum" v-model:current-page="params.pagenum"
v-model:page-size="params.pagesize" v-model:page-size="params.pagesize"
:page-sizes="[2, 5, 7, 15]" :page-sizes="[5, 10, 15, 20]"
:background="true" :background="true"
layout="jumper,total, sizes, prev, pager, next " layout="jumper,total, sizes, prev, pager, next "
:total="total" :total="total"
@ -238,17 +239,26 @@ const goToAnotherPage = (address) => {
margin: 10px 0; margin: 10px 0;
} }
ul { ul {
width: 100%;
list-style-type: none; list-style-type: none;
padding: 10; padding: 10;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: start; justify-content: start;
text-align: center;
display: grid;
grid-template-columns: repeat(auto-fill, 272px);
justify-content: space-around;
} }
li { li {
/* margin-bottom: 30px; */ /* margin-bottom: 30px; */
transition: filter 0.3s; /* 添加过渡动画 */ transition: filter 0.3s; /* 添加过渡动画 */
/* flex: 1 0 20%; */ /* flex: 1 0 20%; */
width: calc(20% - 20px); width: calc(20% - 20px);
width: 250px;
width: 100%;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
text-align: center; text-align: center;

@ -1,11 +1,15 @@
<script lang="ts" setup> <script 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 tool from '@/utils/oss.js'
import '@vueup/vue-quill/dist/vue-quill.snow.css'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
const emit = defineEmits(['getpptresourceList'])
const getresourceList = () => {
emit('getpptresourceList', 'type')
}
// //
const visibleDramwer = ref(false) const visibleDramwer = ref(false)
// //
@ -25,6 +29,10 @@ const formModel = ref({
const rules = { const rules = {
name: [ name: [
{ required: true, message: '请输入资源名称', trigger: 'blur' }, { required: true, message: '请输入资源名称', trigger: 'blur' },
{ min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' },
],
description: [
{ required: true, message: '请输入资源简介', trigger: 'blur' },
{ min: 3, max: 10, message: '长度在 3 到 10 个字符', trigger: 'blur' }, { min: 3, max: 10, message: '长度在 3 到 10 个字符', trigger: 'blur' },
], ],
} }
@ -32,8 +40,6 @@ const rules = {
//open //open
const open = async (row) => { const open = async (row) => {
visibleDramwer.value = true visibleDramwer.value = true
//console.log(row.id)
if (row.id) { if (row.id) {
//row.id //row.id
const res = await CourseResourceControllerService.getAllUsingGet1(row.id) const res = await CourseResourceControllerService.getAllUsingGet1(row.id)
@ -42,7 +48,7 @@ const open = async (row) => {
console.log(res) console.log(res)
// //
//
console.log('编辑回显') console.log('编辑回显')
} else { } else {
// //
@ -57,6 +63,7 @@ defineExpose({
}) })
const selectVal = ref(props.dafulIndex) const selectVal = ref(props.dafulIndex)
const selectOp = ref([ const selectOp = ref([
{ label: 'ppt', value: '1' }, { label: 'ppt', value: '1' },
{ label: '图片', value: '2' }, { label: '图片', value: '2' },
@ -66,35 +73,40 @@ const selectOp = ref([
{ label: '音频', value: '6' }, { label: '音频', value: '6' },
]) ])
const upload = async (option) => {
const res = await tool.oss.upload(option.file)
const url = 'https://wenyu132.oss-cn-beijing.aliyuncs.com/' + res.name
formModel.value.img = url
}
const fileList = ref([]) const fileList = ref([])
function clearFileList() { const clearFileList = () => {
console.log(fileList)
fileList.value.length = 0 fileList.value.length = 0
fileList.value = []
} }
const handleSel = () => { const handleSel = () => {
fileList.value.length = 0 fileList.value.length = 0
} }
//
import type { UploadProps } from 'element-plus'
const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
console.log(uploadFile, uploadFiles)
}
const handlePreview: UploadProps['onPreview'] = (file) => {
console.log(file)
}
const formRef = ref() const formRef = ref()
function isSubmit() { const isSubmit = async () => {
formRef.value.validate((valid, fields) => { formRef.value.validate(async (valid, fields) => {
if (valid) { if (valid) {
const params = { const params = {
name: formModel.value.name, name: formModel.value.name,
type: selectVal.value, type: selectVal.value,
img: fileList.value[0]?.raw, img: formModel.value.img,
description: formModel.value.description, description: formModel.value.description,
path: formModel.value.img,
} }
console.log('根据参数:', params, '去调用接口???') console.log(params)
await CourseResourceControllerService.saveCourseResourceUsingGet1(params)
visibleDramwer.value = false
clearFileList()
ElMessage.success('添加成功')
getresourceList()
} else { } else {
console.log('error submit!', fields) console.log('error submit!', fields)
} }
@ -109,56 +121,64 @@ const beforeAvatarUpload = (rawFile) => {
clearFileList() clearFileList()
ElMessage.error('必须是ppt文件!') ElMessage.error('必须是ppt文件!')
} else { } else {
clearFileList()
fileList.value.push(rawFile) fileList.value.push(rawFile)
} }
break break
case 2: case 2:
if (!rawFile.type.startsWith('image/')) { if (!rawFile.type.startsWith('image/')) {
clearFileList() clearFileList()
ElMessage.error('必须是??文件!') ElMessage.error('必须是图片文件!')
} else {
fileList.value.push(rawFile)
}
break
case 3:
if (!rawFile.type.startsWith('video/')) {
clearFileList()
ElMessage.error('必须是视频文件!')
} else { } else {
clearFileList() clearFileList()
fileList.value.push(rawFile) fileList.value.push(rawFile)
} }
break break
// case 3: case 4:
// if (false) { if (!rawFile.type.startsWith('application/pdf')) {
// clearFileList() clearFileList()
// ElMessage.error('??') ElMessage.error('必须是pdf文件!')
// } else { } else {
// clearFileList() clearFileList()
// fileList.value.push(rawFile) fileList.value.push(rawFile)
// } }
// break break
// case 4: case 5:
// if (false) { if (
// clearFileList() !rawFile.type.startsWith(
// ElMessage.error('??') 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
// } else { ) &&
// clearFileList() !rawFile.type.startsWith('application/msword')
// fileList.value.push(rawFile) ) {
// } clearFileList()
// break ElMessage.error('必须是word文件!')
// case 5: } else {
// if (false) { clearFileList()
// clearFileList() fileList.value.push(rawFile)
// ElMessage.error('??') }
// } else { break
// clearFileList() case 6:
// fileList.value.push(rawFile) if (!rawFile.type.startsWith('audio/')) {
// } clearFileList()
// break ElMessage.error('必须是音频文件!')
// case 6: } else {
// if (false) { clearFileList()
// clearFileList() fileList.value.push(rawFile)
// ElMessage.error('??')
// } else {
// clearFileList()
// fileList.value.push(rawFile)
// }
// break
} }
break
}
}
const isabolish = () => {
clearFileList()
visibleDramwer.value = false
} }
</script> </script>
<template> <template>
@ -201,33 +221,25 @@ const beforeAvatarUpload = (rawFile) => {
<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"
:http-request="upload"
:limit="1" :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-remove="handleRemove"
list-type="picture" list-type="picture"
:before-upload="beforeAvatarUpload" :before-upload="beforeAvatarUpload"
> >
<el-button type="primary">点击上传资源</el-button> <el-button type="primary">点击上传资源</el-button>
<template #tip> <template #file></template>
<div class="el-upload__tip">
jpg/png files with a size less than 500kb
</div>
</template>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="资源简介" prop="description"> <el-form-item label="资源简介" prop="description">
<div class="editor"> <el-input
<quill-editor v-model="formModel.description"
v-model:content="formModel.description" placeholder="请输入资源简介"
content-type="html" ></el-input>
theme="snow"
></quill-editor>
</div>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary">取消</el-button> <el-button type="primary" @click="isabolish">取消</el-button>
<el-button type="info" @click="isSubmit">确定</el-button> <el-button type="info" @click="isSubmit">确定</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>

@ -1,11 +1,11 @@
<script setup> <script setup>
// //
import ppt from '@/assets/icons/ppt (1).png' import ppt from '@/assets/icons/ppt (1).png'
import image from '@/assets/icons/图片 (2).png' import image from '@/assets/icons/image.png'
import video from '@/assets/icons/视频 .png' import video from '@/assets/icons/video.png'
import pdf from '@/assets/icons/pdf (1).png' import pdf from '@/assets/icons/pdf (1).png'
import test from '@/assets/icons/文件.png' import test from '@/assets/icons/test.png'
import audio from '@/assets/icons/音频1.png' import audio from '@/assets/icons/audio.png'
import { ElMessageBox, ElMessage } from 'element-plus' import { ElMessageBox, ElMessage } from 'element-plus'
import { ref } from 'vue' import { ref } from 'vue'
@ -19,14 +19,15 @@ const total = ref(0)
const pptresourceList = ref([]) const pptresourceList = ref([])
const loading = ref(false) const loading = ref(false)
const params = ref({ const params = ref({
pagesize: '15', // pagesize: '10',
pagenum: '1', // pagenum: '1',
type: '1', //ppt type: '1', //ppt
}) })
// //
const getpptresourceList = async () => { const getpptresourceList = async () => {
loading.value = true loading.value = true
console.log(params.value.pagenum)
const res = await CourseResourceControllerService.getAllUsingGet1( const res = await CourseResourceControllerService.getAllUsingGet1(
params.value.pagenum, params.value.pagenum,
params.value.pagesize, params.value.pagesize,
@ -58,6 +59,8 @@ const onSizeChange = (size) => {
} }
const onCurrentChange = (page) => { const onCurrentChange = (page) => {
pptresourceList.value.pagenum = page pptresourceList.value.pagenum = page
params.value.pagenum = page
console.log(page)
getpptresourceList() getpptresourceList()
} }
@ -204,7 +207,7 @@ const onEditResource = (row) => {
<el-pagination <el-pagination
v-model:current-page="currentPage4" v-model:current-page="currentPage4"
v-model:page-size="pageSize4" v-model:page-size="pageSize4"
:page-sizes="[1, 2, 3, 4]" :page-sizes="[5, 10, 15, 20]"
:small="small" :small="small"
:disabled="disabled" :disabled="disabled"
:background="background" :background="background"
@ -219,6 +222,7 @@ const onEditResource = (row) => {
<resource-add <resource-add
:dafulIndex="params.type" :dafulIndex="params.type"
ref="resourceAddRef" ref="resourceAddRef"
@getpptresourceList="getpptresourceList"
></resource-add> ></resource-add>
<!-- --> <!-- -->
</div> </div>
@ -263,10 +267,16 @@ ul {
flex-wrap: wrap; flex-wrap: wrap;
/* justify-content: space-evenly; */ /* justify-content: space-evenly; */
justify-content: start; justify-content: start;
display: grid;
grid-template-columns: repeat(auto-fill, 272px);
justify-content: space-around;
} }
li { li {
transition: filter 0.3s; /* 添加过渡动画 */ transition: filter 0.3s; /* 添加过渡动画 */
width: calc(25% - 25px); width: calc(25% - 25px);
width: 250px;
width: 100%;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
margin-bottom: 10px; margin-bottom: 10px;

Loading…
Cancel
Save