diff --git a/.env.development b/.env.development index 269e196..600aee7 100644 --- a/.env.development +++ b/.env.development @@ -1,5 +1,5 @@ # 变量必须以 VITE_ 为前缀才能暴露给外部读取 NODE_ENV = 'development' VITE_APP_TITLE = '无糖运营平台' -# VITE_APP_BASE_API = 'http://127.0.0.1:8008' -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' diff --git a/src/api/courseChaptersApi.ts b/src/api/courseChaptersApi.ts index 9c5f872..8f4f708 100644 --- a/src/api/courseChaptersApi.ts +++ b/src/api/courseChaptersApi.ts @@ -96,20 +96,20 @@ export const deleteCourse = (params: any) => { // 获取详情 export const getCourseInfo = (params: any) => { return request({ -// <<<<<<< HEAD + // <<<<<<< HEAD url: '/objective_contents/' + params.id, method: 'get', -// // params -// ======= -// <<<<<<< HEAD -// url: '/api/objective_contents/' + params.id, -// method: 'get', -// params, -// ======= -// url: '/objective_contents/' + params.id, -// method: "get", -// // params -// >>>>>>> 1a620e19de970965f426e07348b1dbc4be900eaf -// >>>>>>> 991fa5ab08c56c84c5a276226f8fbc2ec78f859a + // // params + // ======= + // <<<<<<< HEAD + // url: '/api/objective_contents/' + params.id, + // method: 'get', + // params, + // ======= + // url: '/objective_contents/' + params.id, + // method: "get", + // // params + // >>>>>>> 1a620e19de970965f426e07348b1dbc4be900eaf + // >>>>>>> 991fa5ab08c56c84c5a276226f8fbc2ec78f859a }) } diff --git a/src/api/user/user.js b/src/api/user/user.js index 94c9e29..8eb2bd3 100644 --- a/src/api/user/user.js +++ b/src/api/user/user.js @@ -25,6 +25,7 @@ export const userPhoneRegisterService = (jsonData) => { export const userCodeRegisterService = (phoness) => { return request.post('/api/user/code?phone=' + phoness) } + //用户信息接口 export const userGetInfoService = (token) => request.get('/api/user/info', { @@ -46,3 +47,14 @@ export const userIdenChangeService = (dataToSend) => { headers: { 'Content-Type': 'application/json;charset=UTF-8' }, }) } +//修改密码 +export const userChangePasswordService = (dataToSend) => { + return request.post('/api/user/updatePassword', dataToSend) +} + +//获取排名靠前的课程 +export const userToplessonService = () => request.get('#') +//获取最新收藏的课程 +export const userNewLikeService = (id) => { + return request.post('/api/course_favour/newCollect?userId=' + id) +} diff --git a/src/assets/images/default.png b/src/assets/images/default.png new file mode 100644 index 0000000..e16488e Binary files /dev/null and b/src/assets/images/default.png differ diff --git a/src/assets/images/fe.jpg b/src/assets/images/fe.jpg new file mode 100644 index 0000000..ff9e1ba Binary files /dev/null and b/src/assets/images/fe.jpg differ diff --git a/src/layout/tabbar/setting/index.vue b/src/layout/tabbar/setting/index.vue index 6d134b2..a6182ff 100644 --- a/src/layout/tabbar/setting/index.vue +++ b/src/layout/tabbar/setting/index.vue @@ -12,11 +12,22 @@ + + @@ -37,12 +48,16 @@ // import { useDark, useToggle } from '@vueuse/core' import useLayoutSettingStoe from '@/store/modules/setting' import useUserStore from '@/store/modules/user' +import { onMounted } from 'vue' import { useRouter, useRoute } from 'vue-router' +// import default from '@/assets/images/default.jpg' +import defImg from '@/assets/images/default.png' // import { Moon, Sunny } from '@element-plus/icons-vue' const useStore = useLayoutSettingStoe() const userStore = useUserStore() const $router = useRouter() const $route = useRoute() + // 全屏方法 const fullScreen = () => { let full = document.fullscreenElement @@ -56,7 +71,6 @@ const fullScreen = () => { const refresh = () => { useStore.refresh = !useStore.refresh } - // 用户下拉框事件 const handleCommand = (command: string) => { switch (command) { @@ -65,18 +79,28 @@ const handleCommand = (command: string) => { break } } +//跳转链接 +const openWeb = (url, name) => { + window.open(url, name, '_blank') +} + +//用户头像 +onMounted(() => { + userStore.getUserInfo() + console.log(userStore.data.icon, 'icon') +}) + const logout = () => { console.log($route) - userStore.logout() $router.push({ path: '/login', query: { redirect: $route.path }, }) } + // import IconEpSunny from '~icons/ep/sunny'; // import IconEpMoon from '~icons/ep/moon'; - // const isDark = useDark() // const toggleDark = () => useToggle(isDark) diff --git a/src/router/routers.ts b/src/router/routers.ts index 6724cb7..72d0554 100644 --- a/src/router/routers.ts +++ b/src/router/routers.ts @@ -308,5 +308,5 @@ export const constantRoute: any = [ hidden: true, icon: 'Notebook', }, - } + }, ] diff --git a/src/setting.ts b/src/setting.ts index acf187d..7734acc 100644 --- a/src/setting.ts +++ b/src/setting.ts @@ -3,4 +3,7 @@ export default { title: '教学一体化后台', //项目标题 logo: '/public/vite.svg', //项目logo logoHidden: true, // logo隐藏设置 + 'files.associations': { + '*.vue': 'html', + }, } diff --git a/src/store/index.ts b/src/store/index.ts index 68dd922..5fee903 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,9 +1,9 @@ // 引入仓库 import { createPinia } from 'pinia' -import persist from 'pinia-plugin-persistedstate' +// import persist from 'pinia-plugin-persistedstate' // 创建仓库 const pinia = createPinia() // 暴露仓库 -pinia.use(persist) +// pinia.use(persist) export default pinia -export * from './modules/user' +// export * from './modules/user' diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 2f5d534..214a405 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,5 @@ // 创建用户相关的仓库 import { defineStore } from 'pinia' -// 引入登录接口 -// import { reqLogin, getUserInfo } from '@/api/user/index' // 引入登录参数类型 import { loginType } from '@/api/user/types' // 引入ElementPlus通知插件 @@ -21,136 +19,108 @@ import { userIdenService, } from '@/api/user/user.js' -const useUserStore = defineStore( - 'User', - { - // @ts-expect-error - - state: (): LoginStoreType => { - return { - token: GET_TKOEN('TOKEN') || '', - menuRoutes: constantRoute, //存储生成菜单路由数据 - userName: '', // 用户姓名 - avatar: '', // 用户头像 - routes: '', - phone: '', - userInfo: {}, // 当前用户相关信息 - data: {}, +const useUserStore = defineStore('User', { + // @ts-expect-error + state: (): LoginStoreType => { + return { + token: GET_TKOEN('TOKEN') || '', + menuRoutes: constantRoute, //存储生成菜单路由数据 + userName: '', // 用户姓名 + avatar: '', // 用户头像 + routes: '', + phone: '', + userInfo: {}, // 当前用户相关信息 + data: {}, + } + }, + actions: { + // 登录事件 + async userLogin(data: any) { + // console.log(data, 'pinia') + const res: any = 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({ + type: 'success', + message: '登录成功!', + title: `Hi ${getTime()}!`, + }) + return 'ok' + } else { + // ElNotification({ + // // type: 'error', + // message: res.message, + // }) + ElMessage.error(res.message) + return Promise.reject(new Error(res.data.message)) } }, - actions: { - // 登录事件 - async userLogin(data: any) { - // console.log(data, 'pinia') - const res: any = await userLoginService(data).catch((error) => { - ElMessage.error(error.response.data.message) - console.log(error, 'error') + //手机号登录 + async userPhoneLogin(data: loginType) { + const res: any = await userPhoneLoginService(data) + // console.log(res, 11111) + if (res.code === 200) { + this.token = res.data.token as string //接收返回的token + // @ts-expect-error + SET_TKOEN('TOKEN', this.token) + // localStorage.setItem('TOKEN', this.token) + ElNotification({ + type: 'success', + message: '登录成功!', + title: `Hi ${getTime()}!`, }) - - if (res.code === 200) { - // @ts-expect-error - this.token = res.data.token as string - // @ts-expect-error - - SET_TKOEN('TOKEN', this.token) - // localStorage.setItem('TOKEN', this.token) - ElNotification({ - type: 'success', - message: '登录成功!', - title: `Hi ${getTime()}!`, - }) - return 'ok' - } else { - // ElNotification({ - // // type: 'error', - // message: res.message, - // }) - ElMessage.error(res.message) - return Promise.reject(new Error(res.data.message)) - } - }, - //手机号登录 - async userPhoneLogin(data: loginType) { - const res: any = await userPhoneLoginService(data) - console.log(res, 11111) - if (res.code === 200) { - // @ts-expect-error - - this.token = res.data.token as string //接收返回的token - // @ts-expect-error - - SET_TKOEN('TOKEN', this.token) - // localStorage.setItem('TOKEN', this.token) - ElNotification({ - type: 'success', - message: '登录成功!', - title: `Hi ${getTime()}!`, - }) - return 'ok' - } else { - ElNotification({ - type: 'error', - message: res.message, - }) - return Promise.reject(new Error(res.data.message)) - } - }, - // 获取用户信息事件 - async getUserInfo() { - const result: any = await userGetInfoService(GET_TKOEN('TOKEN')) - if (result.code === 200) { - const res = await userIdenService(result.data.id) - console.log(res, 'huonghu') - - // @ts-expect-error - - this.userInfo = res.data - // console.log(this.userInfo, 'this.userInfo') - // @ts-expect-error - - this.data = result.data - console.log(result, '123') - // @ts-expect-error - - this.userName = result.data.username - // this.avatar = result.data.checkUser.avatar - // @ts-expect-error - - this.routes = result.data.permissions - return { - result, - } - } else { - return Promise.reject('登录过期') + return 'ok' + } else { + ElNotification({ + type: 'error', + message: res.message, + }) + return Promise.reject(new Error(res.data.message)) + } + }, + // 获取用户信息 + async getUserInfo() { + const result: any = await userGetInfoService(GET_TKOEN('TOKEN')) + if (result.code === 200) { + 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, } - }, - // 退出登录事件 - logout() { - const usePermissionStore = permissionStore() - console.log(usePermissionStore) - // 清除token - REMOVE_TOKEN('TOKEN'), - // ;(this.userName = ''), (this.avatar = '') - // @ts-expect-error - - (this.userName = ''), - // @ts-expect-error - - (this.avatar = '') + } else { + return Promise.reject('登录过期') + } + }, + // 退出登录事件 + logout() { + const usePermissionStore = permissionStore() + // console.log(usePermissionStore) + // 清除token + REMOVE_TOKEN('TOKEN'), + // ;(this.userName = ''), (this.avatar = '') // @ts-expect-error - - this.token = '' + (this.userName = ''), // @ts-expect-error - - this.routes = '' - usePermissionStore.removeRouter() - location.reload() - }, + (this.avatar = '') + this.token = '' + this.routes = '' + usePermissionStore.removeRouter() + location.reload() }, - getters: {}, - }, - { - persist: true, // 持久化 }, -) + getters: {}, +}) export default useUserStore diff --git a/src/views/course/CourseObjectives.vue b/src/views/course/CourseObjectives.vue index 428eac1..4f3e3cb 100644 --- a/src/views/course/CourseObjectives.vue +++ b/src/views/course/CourseObjectives.vue @@ -18,7 +18,6 @@ const route = useRoute() const router = useRouter() // id : 分目标id // targetId : 选中的分类 - const targetList = ref([ { label: '课程目标一', @@ -114,7 +113,7 @@ const filterTarger = (target) => { return res.label } -const editdata = ref({ id: '', objectiveId:'' }) +const editdata = ref({ id: '', objectiveId: '' }) // 编辑事件 const flog = ref(false) const editBook = async (obj) => { diff --git a/src/views/course/components/KnowledgeGraphUi/AddOrEdit copy.vue b/src/views/course/components/KnowledgeGraphUi/AddOrEdit copy.vue index 3780716..cc16136 100644 --- a/src/views/course/components/KnowledgeGraphUi/AddOrEdit copy.vue +++ b/src/views/course/components/KnowledgeGraphUi/AddOrEdit copy.vue @@ -1,213 +1,253 @@ - \ No newline at end of file + diff --git a/src/views/course/components/KnowledgeGraphUi/FoldAdd.vue b/src/views/course/components/KnowledgeGraphUi/FoldAdd.vue index e7d54ad..bf7f832 100644 --- a/src/views/course/components/KnowledgeGraphUi/FoldAdd.vue +++ b/src/views/course/components/KnowledgeGraphUi/FoldAdd.vue @@ -1,155 +1,196 @@ - \ No newline at end of file + diff --git a/src/views/course/components/KnowledgeGraphUi/FoldEdit.vue b/src/views/course/components/KnowledgeGraphUi/FoldEdit.vue index 7e5fcd4..b716d29 100644 --- a/src/views/course/components/KnowledgeGraphUi/FoldEdit.vue +++ b/src/views/course/components/KnowledgeGraphUi/FoldEdit.vue @@ -1,72 +1,101 @@ - \ No newline at end of file + diff --git a/src/views/course/courseChapters.vue b/src/views/course/courseChapters.vue index 507cbf2..4f5cd20 100644 --- a/src/views/course/courseChapters.vue +++ b/src/views/course/courseChapters.vue @@ -1,50 +1,79 @@ - - diff --git a/src/views/home/components/ConHeader.vue b/src/views/home/components/ConHeader.vue index c5161af..2fc446a 100644 --- a/src/views/home/components/ConHeader.vue +++ b/src/views/home/components/ConHeader.vue @@ -25,7 +25,7 @@ function handleClick() { .info_title { display: flex; justify-content: space-between; - align-items: center; + width: 98%; .title_name { font-family: Inter, Inter; font-weight: 400; @@ -46,19 +46,4 @@ function handleClick() { justify-content: center; align-items: center; } -// .overlay { -// position: absolute; -// top: 181px; -// left: 1278px; -// width: 40px; -// height: 30px; -// // background-color: lightgray; -// border: 1px solid black; -// z-index: 1000; -// display: flex; -// justify-content: center; -// flex-direction: column; -// align-items: center; -// margin-bottom: 10px; -// } diff --git a/src/views/home/components/Info.vue b/src/views/home/components/Info.vue index 05f4894..a96b9cd 100644 --- a/src/views/home/components/Info.vue +++ b/src/views/home/components/Info.vue @@ -1,72 +1,72 @@ diff --git a/src/views/home/components/Status.vue b/src/views/home/components/Status.vue index db53eda..197db0d 100644 --- a/src/views/home/components/Status.vue +++ b/src/views/home/components/Status.vue @@ -1,48 +1,21 @@ diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 59116ea..b1d3c35 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -1,13 +1,17 @@ diff --git a/src/views/login/index.vue b/src/views/login/index.vue index db2c982..7b1955a 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -281,20 +281,11 @@ + diff --git a/src/views/student/login.vue b/src/views/student/login.vue deleted file mode 100644 index 89bfa2a..0000000 --- a/src/views/student/login.vue +++ /dev/null @@ -1,68 +0,0 @@ - - -