From a74923f1e9398abb22715b20e5ce0597e9446909 Mon Sep 17 00:00:00 2001 From: ww Date: Tue, 18 Jun 2024 14:53:33 +0800 Subject: [PATCH] zy --- src/api/user/user.js | 4 +- src/store/modules/user.ts | 27 +- src/views/course/CourseObjectives.vue | 122 +++- src/views/group/index.vue | 181 +----- .../home/components/{Class.vue => Class1.vue} | 0 src/views/home/components/Class2.vue | 108 ++++ src/views/home/components/Info.vue | 149 +++-- src/views/home/components/Status.vue | 23 +- .../components/{Student.vue => Student1.vue} | 0 src/views/home/components/Student2.vue | 97 ++++ src/views/home/index.vue | 49 +- src/views/login/index.vue | 255 ++++---- src/views/message/index.vue | 106 +--- src/views/portal/courseHomepage.vue | 172 +----- src/views/student/index.vue | 546 +----------------- 15 files changed, 650 insertions(+), 1189 deletions(-) rename src/views/home/components/{Class.vue => Class1.vue} (100%) create mode 100644 src/views/home/components/Class2.vue rename src/views/home/components/{Student.vue => Student1.vue} (100%) create mode 100644 src/views/home/components/Student2.vue diff --git a/src/api/user/user.js b/src/api/user/user.js index c67d56e..02399b7 100644 --- a/src/api/user/user.js +++ b/src/api/user/user.js @@ -41,8 +41,8 @@ export const userIdenService = (id) => { return request.post('/user/personal/info?id=' + id) } //修改身份信息 -export const userIdenChangeService = (jsonData) => { - return request.post('', jsonData, { +export const userIdenChangeService = (dataToSend) => { + return request.post('/user/update/PersonalInfo', dataToSend, { headers: { 'Content-Type': 'application/json;charset=UTF-8' }, }) } diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 9ff67ca..f4901ac 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -5,7 +5,7 @@ import { reqLogin, getUserInfo } from '@/api/user/index' // 引入登录参数类型 import { loginType, loginResponseType } from '@/api/user/types' // 引入ElementPlus通知插件 -import { ElNotification } from 'element-plus' +import { ElMessage, ElNotification } from 'element-plus' import { getTime } from '@/utils/time' import { LoginStoreType } from '../modules/type/types' // 引入设置token的方法 @@ -15,7 +15,6 @@ import { constantRoute } from '@/router/routers' import permissionStore from './permission' // 引入路由 import { - userRegisterService, userLoginService, userGetInfoService, userPhoneLoginService, @@ -37,10 +36,15 @@ const useUserStore = defineStore( // 登录事件 async userLogin(data: loginType) { console.log(data, 'pinia') - const res: loginResponseType = await userLoginService(data) - this.token = res.data.token as string - console.log(res, '传回的值1') + const res: loginResponseType = await userLoginService(data).catch( + (error) => { + ElMessage.error(error.response.data.message) + console.log(error, 'error') + }, + ) + if (res.code === 200) { + this.token = res.data.token as string SET_TKOEN('TOKEN', this.token) // localStorage.setItem('TOKEN', this.token) ElNotification({ @@ -51,19 +55,20 @@ const useUserStore = defineStore( return 'ok' } else { console.log(res, '33333') - ElNotification({ - // type: 'error', - message: res.message, - }) + // ElNotification({ + // // type: 'error', + // message: res.message, + // }) + ElMessage.error(res.message) return Promise.reject(new Error(res.data.message)) } }, //手机号登录 async userPhoneLogin(data: loginType) { const res: loginResponseType = await userPhoneLoginService(data) - this.token = res.data.token as string //接收返回的token console.log(res, 11111) if (res.code === 200) { + this.token = res.data.token as string //接收返回的token SET_TKOEN('TOKEN', this.token) // localStorage.setItem('TOKEN', this.token) ElNotification({ @@ -75,7 +80,7 @@ const useUserStore = defineStore( } else { ElNotification({ type: 'error', - message: res.data.message, + message: res.message, }) return Promise.reject(new Error(res.data.message)) } diff --git a/src/views/course/CourseObjectives.vue b/src/views/course/CourseObjectives.vue index 87b0412..2a660ac 100644 --- a/src/views/course/CourseObjectives.vue +++ b/src/views/course/CourseObjectives.vue @@ -1,9 +1,121 @@ - - - + + + diff --git a/src/views/group/index.vue b/src/views/group/index.vue index 4fc55f6..6978e96 100644 --- a/src/views/group/index.vue +++ b/src/views/group/index.vue @@ -1,181 +1,6 @@ + - - - + diff --git a/src/views/home/components/Class.vue b/src/views/home/components/Class1.vue similarity index 100% rename from src/views/home/components/Class.vue rename to src/views/home/components/Class1.vue diff --git a/src/views/home/components/Class2.vue b/src/views/home/components/Class2.vue new file mode 100644 index 0000000..62a7f03 --- /dev/null +++ b/src/views/home/components/Class2.vue @@ -0,0 +1,108 @@ + + + diff --git a/src/views/home/components/Info.vue b/src/views/home/components/Info.vue index 5f2de25..e021807 100644 --- a/src/views/home/components/Info.vue +++ b/src/views/home/components/Info.vue @@ -1,26 +1,16 @@