From 813af6a605f627d74c20b1d15bc4db3bebccdfee Mon Sep 17 00:00:00 2001 From: lijiaqi <1205620597@qq.com> Date: Fri, 21 Jun 2024 18:29:08 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 3 +- src/views/course/basicCourseInformation.vue | 4 +-- src/views/course/components/courseEdit.vue | 36 +++++-------------- ...s.timestamp-1718962043727-a5f9abeb4a0c.mjs | 0 4 files changed, 12 insertions(+), 31 deletions(-) create mode 100644 vite.config.ts.timestamp-1718962043727-a5f9abeb4a0c.mjs diff --git a/.env.development b/.env.development index 330efcc..e529cf2 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,5 @@ # 变量必须以 VITE_ 为前缀才能暴露给外部读取 NODE_ENV = 'development' VITE_APP_TITLE = '无糖运营平台' -VITE_APP_BASE_API = 'http://127.0.0.1:8080' \ No newline at end of file +# VITE_APP_BASE_API = 'http://39.106.16.162:8080' +VITE_APP_BASE_API = 'http://127.0.0.1:8080' diff --git a/src/views/course/basicCourseInformation.vue b/src/views/course/basicCourseInformation.vue index c9968f6..f730006 100644 --- a/src/views/course/basicCourseInformation.vue +++ b/src/views/course/basicCourseInformation.vue @@ -106,9 +106,9 @@ const onEditCourse = (item: any) => { } // const onSuccess = () => { - // loading.value = true + loading.value = true getCourseList() - // loading.value = false + loading.value = false } // const onDeleteCourse = async (id: any) => { diff --git a/src/views/course/components/courseEdit.vue b/src/views/course/components/courseEdit.vue index 818aee1..9f625ae 100644 --- a/src/views/course/components/courseEdit.vue +++ b/src/views/course/components/courseEdit.vue @@ -24,7 +24,7 @@ const formRef = ref() // } // const beforeAvatarUpload = (file: any) => {} const defaultForm = { - teacher: '2140110334', + teacher: userStore.userName, img: '', name: '', category: ref(''), @@ -162,7 +162,7 @@ defineExpose({ open }) const props = defineProps(['flog']) const onSubmit = async () => { - console.log(formModel.value, 'formModel.value') + // console.log(formModel.value, 'formModel.value') formModel.value.classhours = formModel.value.classhours.toString() await formRef.value.validate() @@ -173,38 +173,23 @@ const onSubmit = async () => { emit('CloseCouresNameChange') emit('success') } else { + console.log(formModel.value, 'formModel.value') // console.log(formModel.value) await addCourseApi(formModel.value) + ElMessage.success('添加成功') // 传递关闭抽屉事件 + emit('CloseCouresNameChange') + emit('success') // emit('ClosecreditChange') // emit('CloseclasshoursChange') } formModel.value = { ...defaultForm } imgUrl.value = '' - emit('success') + visibleDrawer.value = false } - -// const fileList: any = ref([]) -// function updHandle() { -// updFile() -// } -// function updFile() { -// const fileName = fileList.value[0]?.name -// const file = fileList.value[0]?.raw - -// try { -// client() -// .multipartUpload(fileName, file) -// .then((res) => { -// console.log(res, '拿到图片url') -// }) -// } catch (error) { -// console.log(error, 'error') -// } -// } // 新增数据子传父 const emit = defineEmits([ 'success', @@ -347,17 +332,12 @@ const upload = async (option: any) => { > - + diff --git a/vite.config.ts.timestamp-1718962043727-a5f9abeb4a0c.mjs b/vite.config.ts.timestamp-1718962043727-a5f9abeb4a0c.mjs new file mode 100644 index 0000000..e69de29 From be30aa3792cb624d502258e652d73782802de484 Mon Sep 17 00:00:00 2001 From: lijiaqi <1205620597@qq.com> Date: Sat, 20 Jul 2024 11:02:51 +0800 Subject: [PATCH 02/11] 1 --- src/store/modules/user.ts | 3 ++- src/views/course/basicCourseInformation.vue | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 6f59f3c..4ff1a32 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -103,9 +103,10 @@ const useUserStore = defineStore( if (result.code === 200) { const res = await userIdenService(result.data.id) // @ts-expect-error + console.log(res.data, 'res.data') this.userInfo = res.data - // console.log(this.userInfo, 'this.userInfo') + console.log(this.userInfo, 'this.userInfo') // @ts-expect-error this.data = result.data diff --git a/src/views/course/basicCourseInformation.vue b/src/views/course/basicCourseInformation.vue index f730006..fba21ab 100644 --- a/src/views/course/basicCourseInformation.vue +++ b/src/views/course/basicCourseInformation.vue @@ -20,14 +20,14 @@ const router = useRouter() // console.log(route) // import { client } from '@/utils/alioss.js' // 课程列表 -const courseList = ref([]) +const courseList = ref() // 教师列表 -const teacherList = ref([]) +const teacherList = ref() const getTeacherList = async () => { const res = await getTeacherListApi() - console.log(res) + console.log(res, 'teacher') teacherList.value = res.data - console.log(teacherList.value) + console.log(teacherList.value, 'teacherList.value') } const total = ref(0) const params = ref({ @@ -45,14 +45,14 @@ const loading = ref(false) const getCourseList = async () => { loading.value = true // console.log(params.value, '11') - if (userStore.userInfo.roleId === 2) { + if (userStore.userInfo.roleId[0] === 2) { params.value.pageSize = 8 } const res = await getCourseListApi(params.value) courseList.value = res.data.list total.value = res.data.total - console.log(res.data.list) + console.log(courseList.value, 'courseList.value') loading.value = false // console.log(userStore.userName, '1111') } @@ -171,7 +171,7 @@ const CloseCouresNameChangeEvent = () => {
- + Date: Sun, 21 Jul 2024 21:09:12 +0800 Subject: [PATCH 03/11] 1 --- src/views/course/basicCourseInformation.vue | 54 +++++++------------ src/views/course/components/courseEdit.vue | 58 +++++---------------- 2 files changed, 31 insertions(+), 81 deletions(-) diff --git a/src/views/course/basicCourseInformation.vue b/src/views/course/basicCourseInformation.vue index fba21ab..d2e9cf1 100644 --- a/src/views/course/basicCourseInformation.vue +++ b/src/views/course/basicCourseInformation.vue @@ -110,7 +110,7 @@ const onSuccess = () => { getCourseList() loading.value = false } -// +//删除 const onDeleteCourse = async (id: any) => { await ElMessageBox.confirm('您确定删除这条课程信息吗', '温馨提示', { confirmButtonText: '确认', @@ -174,12 +174,8 @@ const CloseCouresNameChangeEvent = () => { - + @@ -208,11 +204,7 @@ const CloseCouresNameChangeEvent = () => {
    -
  • +
  • @@ -242,36 +234,19 @@ const CloseCouresNameChangeEvent = () => { - + 查看课程目标
- +
- + @@ -317,6 +292,7 @@ const CloseCouresNameChangeEvent = () => { } .course { + // display: flex; // flex: 0 0 25%; // justify-content: space-between; @@ -354,6 +330,7 @@ const CloseCouresNameChangeEvent = () => { margin-left: 30px; margin-top: 10px; font-weight: bold; + &:hover { cursor: pointer; } @@ -399,6 +376,7 @@ const CloseCouresNameChangeEvent = () => { .plus { width: 100%; height: 178px; + &:hover { cursor: pointer; } @@ -413,8 +391,10 @@ const CloseCouresNameChangeEvent = () => { text-align: center; } } + .add_course { border: 2px dashed rgb(143, 139, 139); + h2 { font-size: 40px; text-align: center; @@ -422,11 +402,13 @@ const CloseCouresNameChangeEvent = () => { color: #535050; font-weight: bold; margin-top: 20px; + &:hover { cursor: pointer; } } } + .short-form-item { width: 250px; margin-right: 65px; diff --git a/src/views/course/components/courseEdit.vue b/src/views/course/components/courseEdit.vue index 9f625ae..702e3eb 100644 --- a/src/views/course/components/courseEdit.vue +++ b/src/views/course/components/courseEdit.vue @@ -164,7 +164,6 @@ const props = defineProps(['flog']) const onSubmit = async () => { // console.log(formModel.value, 'formModel.value') formModel.value.classhours = formModel.value.classhours.toString() - await formRef.value.validate() const isEdit = formModel.value.id if (isEdit) { @@ -172,6 +171,7 @@ const onSubmit = async () => { ElMessage.success('修改成功') emit('CloseCouresNameChange') emit('success') + console.log(formModel.value, 'formModel.value') } else { console.log(formModel.value, 'formModel.value') // console.log(formModel.value) @@ -211,22 +211,7 @@ const courseNameInput = () => { emit('couresNameChange', formModel.value.name) } } -// const creditInput = () => { -// if (!props.flog) { -// emit('creditChange', formModel.value.credit) -// } -// } -// const classhoursInput = () => { -// if (!props.flog) { -// emit('classhoursChange', formModel.value.classhours) -// } -// } -// watch( -// () => props.flog, -// (newVal) => { -// console.log(newVal) -// }, -// ) + onMounted(() => { console.log(props.flog) }) @@ -252,20 +237,11 @@ const upload = async (option: any) => {