develoop
edana 5 months ago
parent 2712461a0d
commit 198166a21a
  1. 3
      .env.development
  2. 4
      generated/core/OpenAPI.ts
  3. 2
      generated/services/CourseResourceControllerService.ts
  4. 1
      package.json
  5. 7755
      pnpm-lock.yaml
  6. 6
      src/api/user/index.ts
  7. 18
      src/api/user/user.js
  8. 0
      src/assets/icons/audio.png
  9. 0
      src/assets/icons/image.png
  10. 0
      src/assets/icons/test.png
  11. 0
      src/assets/icons/video.png
  12. BIN
      src/assets/images/PDF .png
  13. BIN
      src/assets/images/audio.png
  14. BIN
      src/assets/images/test.png
  15. BIN
      src/assets/images/video.png
  16. 4
      src/store/modules/user.ts
  17. 16
      src/views/MyCourseStudy/learningProcess.vue
  18. 162
      src/views/courseResources/componse/resourceAdd.vue
  19. 24
      src/views/courseResources/index.vue

@ -1,4 +1,5 @@
# 变量必须以 VITE_ 为前缀才能暴露给外部读取
NODE_ENV = 'development'
VITE_APP_TITLE = '无糖运营平台'
VITE_APP_BASE_API = 'http://39.106.16.162:8080'
VITE_APP_BASE_API = 'http://127.0.0.1:8080'
# VITE_APP_BASE_API = 'http://39.106.16.162:8080'

@ -20,8 +20,10 @@ export type OpenAPIConfig = {
ENCODE_PATH?: ((path: string) => string) | undefined;
};
export const OpenAPI: OpenAPIConfig = {
BASE: 'http://39.106.16.162:8080',
// BASE: 'http://39.106.16.162:8080',
BASE: 'http://127.0.0.1:8080/api',
VERSION: '1.0.0',
WITH_CREDENTIALS: false,
CREDENTIALS: 'include',

@ -85,7 +85,7 @@ export class CourseResourceControllerService {
courseResources: CourseResources,
): CancelablePromise<BaseResponse_string_> {
return __request(OpenAPI, {
method: 'GET',
method: 'POST',
url: '/courses/save',
body: courseResources,
errors: {

@ -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

@ -3,9 +3,9 @@ import { loginType, loginResponseType, userInfoType } from './types'
//项目用户相关的请求地址
enum API {
LOGIN_URL = '/user/login',
USERINFO_URL = '/user/info',
LOGOUT_URL = '/user/logout',
LOGIN_URL = 'api/user/login',
USERINFO_URL = 'api/user/info',
LOGOUT_URL = 'api/user/logout',
}
// 用户登录
export const reqLogin = (data: loginType) =>

@ -1,48 +1,48 @@
import request from '@/utils/request'
//账号登录接口
export const userLoginService = (loginData) => {
return request.post('/user/login', loginData, {
return request.post('/api/user/login', loginData, {
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
})
}
//手机号登录接口
export const userPhoneLoginService = (phones) => {
return request.post('/user/phone/login?phone=' + phones)
return request.post('/api/user/phone/login?phone=' + phones)
}
//账号注册接口
export const userRegisterService = (jsonData) => {
return request.post('/user/register', jsonData, {
return request.post('/api/user/register', jsonData, {
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
})
}
//手机号注册接口
export const userPhoneRegisterService = (jsonData) => {
return request.post('/user/phone/register', jsonData, {
return request.post('/api/user/phone/register', jsonData, {
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
})
}
//手机号验证码请求
export const userCodeRegisterService = (phoness) => {
return request.post('/user/code?phone=' + phoness)
return request.post('/api/user/code?phone=' + phoness)
}
//用户信息接口
export const userGetInfoService = (token) =>
request.get('/user/info', {
request.get('/api/user/info', {
headers: { Authorization: `Bearer ${token}` },
})
//修改用户信息
export const userChangeService = (jsonData) => {
return request.post('/user/update', jsonData, {
return request.post('/api/user/update', jsonData, {
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
})
}
//获取身份信息
export const userIdenService = (id) => {
return request.post('/user/personal/info?id=' + id)
return request.post('/api/user/personal/info?id=' + id)
}
//修改身份信息
export const userIdenChangeService = (dataToSend) => {
return request.post('/user/update/PersonalInfo', dataToSend, {
return request.post('/api/user/update/PersonalInfo', dataToSend, {
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
})
}

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

@ -99,9 +99,7 @@ const useUserStore = defineStore(
console.log(result, '123')
this.userName = result.data.username
// this.avatar = result.data.checkUser.avatar
this.routes = result.data.menus.map((item) => {
return item.name
})
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