diff --git a/src/api/user/stud.js b/src/api/user/stud.js index b3d38b1..d86c210 100644 --- a/src/api/user/stud.js +++ b/src/api/user/stud.js @@ -1,15 +1,22 @@ import request from '@/utils/request' //分页查询 export const stuPageService = (params) => { - // console.log(params, 'params') + // console.log(params, 'params11') return request.get( `/api/studentManage/page?name=${params.name}&number=${params.number}&page=${params.page}&pageSize=${params.pagesize}&userId=${params.id}`, ) } -//获取学生 -export const stuListService = (id) => { - return request.get(`/api/studentManage/${id}`) +//学号查询 +export const stuNumberService = (params) => { + // console.log(params, 'params') + return request.get( + `/api/studentManage/page?number=${params.number}&page=${params.page}&pageSize=${params.pagesize}&userId=${params.id}`, + ) } +//获取学生 +// export const stuListService = (id) => { +// return request.get(`/api/studentManage/${id}`) +// } //删除和批量删除学生 export const delStuListService = (ids) => { return request.delete(`/api/studentManage/batchDelete?ids=${ids}`) @@ -18,7 +25,7 @@ export const delStuListService = (ids) => { export const reStuPassService = (ids) => { return request.put(`/api/studentManage/initialPassword?ids=${ids}`) } -//重置学生密码 +//重置状态 export const changeStaService = (status, id) => { return request.post(`/api/studentManage/status/${status}?id=${id}`) } diff --git a/src/api/user/user.js b/src/api/user/user.js index 4064558..84b69b7 100644 --- a/src/api/user/user.js +++ b/src/api/user/user.js @@ -33,10 +33,7 @@ export const userGetInfoService = (token) => }) //修改用户信息 export const userChangeService = (params) => { - // return request.post('/api/user/update', jsonData, { - // headers: { 'Content-Type': 'application/json;charset=UTF-8' }, - // }) - return request.post(`/api/user/update/PersonalInfo`, params) + return request.post(`/api/user/update`, params) } //获取个人信息 export const userIdenService = (id) => { diff --git a/src/layout/tabbar/setting/index.vue b/src/layout/tabbar/setting/index.vue index 22360a1..48a8784 100644 --- a/src/layout/tabbar/setting/index.vue +++ b/src/layout/tabbar/setting/index.vue @@ -87,11 +87,11 @@ const openWeb = (url, name) => { //用户头像 onMounted(() => { userStore.getUserInfo() - console.log(userStore.data.icon, 'icon') + // console.log(userStore.data.icon, 'icon') }) const logout = () => { - console.log($route) + // console.log($route) userStore.logout() $router.push({ path: '/login', diff --git a/src/router/routers.ts b/src/router/routers.ts index 0352627..981c4a0 100644 --- a/src/router/routers.ts +++ b/src/router/routers.ts @@ -21,7 +21,7 @@ export const constantRoute: any = [ // }, // }, // ], - redirect: '/curriculumCenter/basicCourseInformation', + redirect: '/home', children: [ { path: '/home', @@ -45,6 +45,28 @@ export const constantRoute: any = [ icon: 'Notebook', }, }, + { + path: '/mssageManagement', + component: () => import('@/layout/index.vue'), + name: 'MssageManagement', + meta: { + title: '', + hidden: false, + icon: 'HomeFilled', // 菜单图标 + }, + children: [ + { + path: '/mssageManagement/message', + component: () => import('@/views/message/index.vue'), + name: 'Message', + meta: { + title: '消息', + hidden: false, + icon: 'ChatDotSquare', + }, + }, + ], + }, { path: '/curriculumCenter', redirect: '/curriculumCenter/basicCourseInformation', @@ -140,28 +162,7 @@ export const constantRoute: any = [ }, ], }, - // { - // path: '/groupManagement', - // component: () => import('@/layout/index.vue'), - // name: 'GroupManagement', - // meta: { - // title: '', - // hidden: false, - // icon: 'HomeFilled', // 菜单图标 - // }, - // children: [ - // { - // path: '/groupManagement/group', - // component: () => import('@/views/group/index.vue'), - // name: 'Group', - // meta: { - // title: '分组', - // hidden: false, - // icon: 'Operation', - // }, - // }, - // ], - // }, + { path: '/mssageManagement', component: () => import('@/layout/index.vue'), diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 214a405..145f75e 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -87,15 +87,12 @@ const useUserStore = defineStore('User', { async getUserInfo() { const result: any = await userGetInfoService(GET_TKOEN('TOKEN')) if (result.code === 200) { - console.log(result, 'result') + // console.log(result, 'result') + // 获取用户个人信息 const res = await userIdenService(result.data.id) - // console.log(res, 'res') this.userInfo = res.data - // console.log(this.userInfo, 'this.userInfo') this.data = result.data - // console.log(result, '123') this.userName = result.data.username - // this.avatar = result.data.checkUser.avatar this.routes = result.data.permissions return { result, diff --git a/src/views/MyCourseStudy/learningProcess.vue b/src/views/MyCourseStudy/learningProcess.vue index e1353c6..fde2a54 100644 --- a/src/views/MyCourseStudy/learningProcess.vue +++ b/src/views/MyCourseStudy/learningProcess.vue @@ -15,7 +15,7 @@ const selectedIds = ref([]) const loading = ref(false) const showCheckbox = ref(false) -onMounted(()=>{ +onMounted(() => { userStore.getUserInfo() }) const params = ref({ @@ -23,13 +23,13 @@ const params = ref({ // pagenum: '1', userId: userStore.data.id, }) -console.log(userStore.data.id); +console.log(userStore.data.id) //获取浏览记录列表 const getrecordList = async () => { loading.value = true // const res = await getRecordListService(params.value) const res = await LearningRecordsControllerService.courseLearningRecords( - params.value.userId, + params.value.userId, params.value.pagenum, params.value.pagesize, ) @@ -108,9 +108,7 @@ const deleteSelected = async () => { }) // 调用已封装好的删除接口进行删除操作 - await LearningRecordsControllerService.deleteCourseRecords( - selectedIds.value, - ) + await LearningRecordsControllerService.deleteCourseRecords(selectedIds.value) .then(() => { recordList.value = recordList.value.filter( (item) => !selectedIds.value.includes(item.id), @@ -125,12 +123,12 @@ const deleteSelected = async () => { } //跳转页面 const router = useRouter() -const goToAnotherPage = (address,courseId) => { +const goToAnotherPage = (address, courseId) => { router.push({ - path:address, - query:{ - courseId: courseId - } + path: address, + query: { + courseId: courseId, + }, }) } // @@ -162,7 +160,17 @@ const goToAnotherPage = (address,courseId) => {
- + diff --git a/src/views/home/components/Status.vue b/src/views/home/components/Status.vue index 3817738..0b4f5ba 100644 --- a/src/views/home/components/Status.vue +++ b/src/views/home/components/Status.vue @@ -61,7 +61,6 @@ const changeInfo = async () => { //用户基本信息的显示与编辑 const dialog = ref(false) - const formLabelWidth = '68px' const form = ref({ name: '', @@ -89,10 +88,10 @@ const onCancel = () => { //编辑表单提交 const onSubmit = async () => { // const jsonData = JSON.stringify(form.value) - console.log(form.value, 'jj') + // console.log(form.value, 'jj') await userChangeService(form).then(() => { ElMessage.success('修改成功') - console.log(form.value, 'aaaa') + // console.log(form.value, 'aaaa') emit('getInfo', form.value) @@ -115,7 +114,7 @@ const onSubmit = async () => { diff --git a/src/views/home/components/Welcome.vue b/src/views/home/components/Welcome.vue index 2d1a493..4ea5c46 100644 --- a/src/views/home/components/Welcome.vue +++ b/src/views/home/components/Welcome.vue @@ -10,6 +10,7 @@ import useUserStore from '@/store/modules/user' import { useRouter } from 'vue-router' import { ElMessage, dayjs } from 'element-plus' import { Edit, Back } from '@element-plus/icons-vue' + const props = defineProps({ name: { type: String, @@ -28,7 +29,7 @@ const pwdForm = ref({ new_pwd: '', re_pwd: '', }) -// console.log(props.userData.username, 'props.data') +// console.log(props.userData, '22222') //dialog显示隐藏 //信息 const dialogFormVisible = ref(false) @@ -133,7 +134,8 @@ const rules = { const infoRef = ref() //修改用户信息 -const emit = defineEmits(['get-message']) +const emit = defineEmits(['get-message', 'userInfoModified']) + const change = ref(true) //验证码倒计时 const countdown = ref(0) @@ -148,7 +150,6 @@ const toggleVisibility = () => { const codecode = ref() const codeSubmit = async () => { await infoRef.value.validate() - // console.log('开始发起注册验证码') const phoness = form.value.newphone userCodeRegisterService(phoness) .then((response) => { @@ -156,69 +157,78 @@ const codeSubmit = async () => { console.log(codecode.value, 'codecode') }) .catch((error) => { - console.log(error.message, 'error') + ElMessage.error(error.newphone.message) + // console.log(error.newphone.message, 'error') }) } -// console.log(change.value == true, 'toggleVisibility.value == false') -// if (toggleVisibility.value == 'false') { -// console.log('值相等,为 false') -// } else { -// console.log('值不相等') -// } +const res = ref() const changeInfo = async () => { await infoRef.value.validate() - if (change.value === true) { - // console.log(form.value.phone, '原手机号') + // console.log(props.userData, '手机号props.data') + if ( + // change.value === true || + (change.value === true && + props.userData.nickName !== form.value.nickName) || + (change.value === false && + form.value.newphone === '' && + props.userData.nickName !== form.value.nickName && + form.value.code === '') + ) { await userChangeService({ phone: form.value.phone, id: form.value.id, nickName: form.value.nickName, - }).then(() => { + }).then(async () => { + // console.log('修改11') ElMessage.success('修改成功') + res.value = await userStore.getUserInfo() + res.value = res.value.result.data + // console.log(res.result.data, '修改用户1') emit('get-message', form.value.nickName) + emit('userInfoModified', res) + dialogFormVisible.value = false + form.value.newphone = '' form.value.code = '' }) - dialogFormVisible.value = false - } else { + } else if ( + change.value === false && + form.value.newphone !== form.value.phone && + form.value.code !== '' + ) { + // console.log('修改22') if (codecode.value === form.value.code) { - // console.log(form.value.newphone, '新手机号') - // console.log('验证码正确') await userChangeService({ phone: form.value.newphone, id: form.value.id, nickName: form.value.nickName, - }).then(() => { + }).then(async () => { ElMessage.success('修改成功') + res.value = userStore.getUserInfo() + // res.value = res.result.data + // console.log(res.value, '修改用户hsouji') + // userStore.getUserInfo() form.value.phone = form.value.newphone - emit('get-phone', form.value.phone) + // emit('get-phone', form.value.phone) + emit('get-message', form.value.nickName) + emit('userInfoModified', res) + dialogFormVisible.value = false + form.value.newphone = '' form.value.code = '' }) - dialogFormVisible.value = false } else { ElMessage.error('验证码错误') } + } else { + // console.log('修改33') + dialogFormVisible.value = false } } -//修改密码 -const pwdRef = ref() -const changePassword = async () => { - await pwdRef.value.validate() - await userChangeService({ - phone: form.value.phone, - id: form.value.id, - nickName: form.value.nickName, - }).then(() => { - ElMessage.success('修改成功') - emit('get-message', form.value.nickName) - form.value.newphone = '' - form.value.code = '' - }) - dialogFormVisible.value = false -} + const cancleInfo = () => { dialogFormVisible.value = false + form.value = { ...props.userData, code: '', newphone: '' } } //修改密码 const userStore = useUserStore() @@ -341,7 +351,12 @@ onUnmounted(() => { - + { const name = ref() const getMessage = (msg) => { name.value = msg + // console.log(name.value, 'msg') } -const getPhone = (phone) => { + +//? +// const getData = async () => { +// const res = await userLookService(userStore.data.id) +// // console.log(res.data, '11111') +// data.value = res.data +// } +const getUserName = (username) => { // console.log(msg, 'msg') - userStore.data.phone = phone - // console.log(data.value.icon, 'icon') + userStore.userName = username + // console.log(data.value.icon, 'icon'); } + const getAvater = (avater) => { // console.log(msg, 'msg') userStore.data.icon = avater // console.log(data.value.icon, 'icon') } + const getInfo = (info) => { - console.log(userStore.userInfo, 'msg') + // console.log(userStore.userInfo, 'msg') userStore.userInfo = info // console.log(userStore.userData, 'icon111') } const courselist = ref([]) -const img = ref() -const courseName = ref() -const courseTea = ref() +// const img = ref() +// const courseName = ref() +// const courseTea = ref() //学习最多的知识点 const maxKnow = ref([]) const getmaxKnow = async () => { const res = await userMaxKnowService(userStore.data.id) maxKnow.value = res.data - console.log(maxKnow.value, 'max') + // console.log(maxKnow.value, 'max') +} +function fetchNewUserInfo(res) { + // 更新 userInfo 的值 + data.value = res } - onMounted(() => { // getData() username.value = userStore.userName @@ -85,14 +92,8 @@ onMounted(() => { //最新收藏的课程 userNewLikeService(userStore.data.id).then((res) => { loading.value = true - // console.log(res.data, '最新收藏的课程') courselist.value = res.data loading.value = false - - // console.log(courselist.value.id, 'course') - // img.value = res.data.img - // courseName.value = res.data.name - // courseTea.value = res.data.teacher }) //echart图表 userLookService() @@ -106,10 +107,10 @@ onMounted(() => { @@ -124,7 +125,7 @@ onMounted(() => {
{ style=" font-size: 14px; display: flex; - /* margin: 0px auto; */ - margin: 0px 10px; + width: 90%; + margin: 0px auto; + /* margin: 0px 10px; */ + margin-bottom: 5px; " > { :urouter="'/curriculumCenter/knowledgePoints'" > -
+

{{ item.label }}

@@ -161,11 +164,17 @@ onMounted(() => {
-
+

Roshabei

@@ -176,7 +185,10 @@ onMounted(() => { href="#" style="width: 90%; font-size: 14px; display: flex; margin: 0 auto" > - +
    @@ -198,7 +210,10 @@ onMounted(() => { href="#" style="width: 90%; font-size: 12px; display: flex; margin: 0 auto" > - +
      @@ -208,11 +223,9 @@ onMounted(() => { :key="item.id" v-loading="loading" > -

      {{ index + 1 }}

      {{ item.name || '暂无' }}
      -
    @@ -264,7 +277,6 @@ onMounted(() => { justify-content: space-between; } .lesson { - background-color: pink; padding-top: 30px; // padding-bottom: 30px; padding: 25px 10px 0px 10px; @@ -284,24 +296,32 @@ onMounted(() => { // align-items: center; // margin: 0 auto; // background-color: yellow; + padding: 5px; - margin-top: 5px; + // margin-top: 5px; flex-wrap: wrap; justify-content: space-evenly; padding-bottom: 30px; } +.contt { + // background-color: yellow; + padding: 5px; + + display: grid; + grid-template-columns: repeat(2, 1fr); + grid-gap: 11px; +} .button { justify-content: space-between; - margin-bottom: 5px; + height: 30px; border-radius: 10px; - // color: #0080ff; + text-align: center; line-height: 30px; - margin: 5px 10px; - // border: 2px solid #ccc; + box-shadow: 0 0 2px rgba(0, 0, 0, 0.1); - width: 40%; + width: 100%; padding: 0px 15px; overflow: hidden; text-overflow: ellipsis; @@ -344,6 +364,8 @@ ul { } .lessonlist-item { + // background-color: pink; + height: 50px; // margin: 0 auto; border-radius: 10px; diff --git a/src/views/login/index.vue b/src/views/login/index.vue index be167ec..0859984 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -1,6 +1,13 @@