Compare commits

...

3 Commits

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

@ -2,4 +2,4 @@
NODE_ENV = 'development'
VITE_APP_TITLE = '无糖运营平台'
VITE_APP_BASE_API = 'http://127.0.0.1:8080'
# VITE_APP_BASE_API = 'http://39.106.16.162:8080'
# VITE_APP_BASE_API = 'http://39.106.16.162:8080'

@ -19,6 +19,7 @@ export type OpenAPIConfig = {
ENCODE_PATH?: ((path: string) => string) | undefined;
};
export const OpenAPI: OpenAPIConfig = {
BASE: 'http://39.106.16.162:8080',
VERSION: '1.0.0',
@ -30,3 +31,17 @@ export const OpenAPI: OpenAPIConfig = {
HEADERS: 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",
"@vueup/vue-quill": "^1.2.0",
"@vueuse/core": "^10.9.0",
"ajax": "^0.0.4",
"ali-oss": "^6.20.0",
"axios": "^1.6.8",
"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.avatar = result.data.checkUser.avatar
// @ts-expect-error
this.routes = result.data.permissions
return {
result,

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

@ -1,11 +1,15 @@
<script lang="ts" setup>
<script setup>
import { ref } from 'vue'
// import axios from 'axios'
import { CourseResourceControllerService } from '../../../../generated/services/CourseResourceControllerService'
const props = defineProps(['dafulIndex'])
import { QuillEditor } from '@vueup/vue-quill'
import '@vueup/vue-quill/dist/vue-quill.snow.css'
import tool from '@/utils/oss.js'
import { ElMessage } from 'element-plus'
const emit = defineEmits(['getpptresourceList'])
const getresourceList = () => {
emit('getpptresourceList', 'type')
}
//
const visibleDramwer = ref(false)
//
@ -25,6 +29,10 @@ const formModel = ref({
const rules = {
name: [
{ 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' },
],
}
@ -32,8 +40,6 @@ const rules = {
//open
const open = async (row) => {
visibleDramwer.value = true
//console.log(row.id)
if (row.id) {
//row.id
const res = await CourseResourceControllerService.getAllUsingGet1(row.id)
@ -42,7 +48,7 @@ const open = async (row) => {
console.log(res)
//
//
console.log('编辑回显')
} else {
//
@ -57,6 +63,7 @@ defineExpose({
})
const selectVal = ref(props.dafulIndex)
const selectOp = ref([
{ label: 'ppt', value: '1' },
{ label: '图片', value: '2' },
@ -66,35 +73,40 @@ const selectOp = ref([
{ 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([])
function clearFileList() {
const clearFileList = () => {
console.log(fileList)
fileList.value.length = 0
fileList.value = []
}
const handleSel = () => {
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()
function isSubmit() {
formRef.value.validate((valid, fields) => {
const isSubmit = async () => {
formRef.value.validate(async (valid, fields) => {
if (valid) {
const params = {
name: formModel.value.name,
type: selectVal.value,
img: fileList.value[0]?.raw,
img: formModel.value.img,
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 {
console.log('error submit!', fields)
}
@ -109,57 +121,65 @@ const beforeAvatarUpload = (rawFile) => {
clearFileList()
ElMessage.error('必须是ppt文件!')
} else {
clearFileList()
fileList.value.push(rawFile)
}
break
case 2:
if (!rawFile.type.startsWith('image/')) {
clearFileList()
ElMessage.error('必须是??文件!')
ElMessage.error('必须是图片文件!')
} else {
fileList.value.push(rawFile)
}
break
case 3:
if (!rawFile.type.startsWith('video/')) {
clearFileList()
ElMessage.error('必须是视频文件!')
} else {
clearFileList()
fileList.value.push(rawFile)
}
break
case 4:
if (!rawFile.type.startsWith('application/pdf')) {
clearFileList()
ElMessage.error('必须是pdf文件!')
} else {
clearFileList()
fileList.value.push(rawFile)
}
break
case 5:
if (
!rawFile.type.startsWith(
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
) &&
!rawFile.type.startsWith('application/msword')
) {
clearFileList()
ElMessage.error('必须是word文件!')
} else {
clearFileList()
fileList.value.push(rawFile)
}
break
case 6:
if (!rawFile.type.startsWith('audio/')) {
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
}
}
const isabolish = () => {
clearFileList()
visibleDramwer.value = false
}
</script>
<template>
<el-drawer
@ -201,33 +221,25 @@ const beforeAvatarUpload = (rawFile) => {
<el-form-item label="上传资源" prop="fileList">
<el-upload
v-model:file-list="fileList"
:http-request="upload"
:limit="1"
class="upload-demo"
action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
:on-preview="handlePreview"
:on-remove="handleRemove"
list-type="picture"
:before-upload="beforeAvatarUpload"
>
<el-button type="primary">点击上传资源</el-button>
<template #tip>
<div class="el-upload__tip">
jpg/png files with a size less than 500kb
</div>
</template>
<template #file></template>
</el-upload>
</el-form-item>
<el-form-item label="资源简介" prop="description">
<div class="editor">
<quill-editor
v-model:content="formModel.description"
content-type="html"
theme="snow"
></quill-editor>
</div>
<el-input
v-model="formModel.description"
placeholder="请输入资源简介"
></el-input>
</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-form-item>
</el-form>

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

Loading…
Cancel
Save