课程首页面

develoop
significative 3 months ago
parent c0ec953709
commit 2e1cef3492
  1. 21
      src/Layout/tabbar/index.vue
  2. 31
      src/api/configuration.ts
  3. BIN
      src/assets/images/default.png
  4. 18
      src/router/module/constRouter/index.ts
  5. 51
      src/store/module/user.ts
  6. 80
      src/views/course/components/StuList.vue
  7. 5
      src/views/course/index.vue
  8. 7
      src/views/professionalListProfile/index.vue

@ -8,19 +8,10 @@
<div class="menu">
<ul>
<template v-for="(item, index) in constRouter[0].children">
<li v-if="index < 2" :class="{ active: settingStore.useIndex === index }" v-show="!item.meta.hidden"
@click="goToRouter(item, index)">
<div>{{ item.meta.title }}</div>
</li>
</template>
<li @click="skip('http://localhost:5173/#/curriculumCenter/basicCourseInformation')">学习路径</li>
<template v-for="(item, index) in constRouter[0].children">
<li v-if="index >= 2" :class="{ active: settingStore.useIndex === index }" v-show="!item.meta.hidden"
@click="goToRouter(item, index)">
<div>{{ item.meta.title }}</div>
</li>
</template>
<li v-for="(item, index) in constRouter[0].children" :class="{ active: settingStore.useIndex === index }"
v-show="!item.meta.hidden" @click="goToRouter(item, index)" :key="item.path">
<div>{{ item.meta.title }}</div>
</li>
<div v-if="isLogin">
<img :src="data.icon" alt="" style="width: 24px; height: 24px; margin: 0 10px; border-radius: 50%" />
<el-dropdown @command="handleCommand">
@ -55,6 +46,8 @@
import useAdminInfoStore from '@/store/module/adminInfo'
const adminInfoStore = useAdminInfoStore()
import { userGetInfoService } from '@/api/configuration';
import useUserStore from '@/store/module/user';
const userStore = useUserStore()
import { constRouter } from '@/router/module/constRouter'
import { useRouter, useRoute } from 'vue-router'
import { onMounted, ref } from 'vue'
@ -81,7 +74,7 @@ onMounted(() => {
})
const isLogin = ref(false)
const data = ref<any>({})
userGetInfoService().then(res => {
userGetInfoService(userStore.token).then(res => {
// @ts-ignore
if (res.code === 200) {
isLogin.value = true

@ -1,22 +1,21 @@
import requset from '@/utils/requset'
import request from '@/utils/requset'
import { ElLoading, ElMessage } from 'element-plus'
import pinia from '@/store';
import userStore from '@/store/module/user';
const user = userStore(pinia)
enum Api {
get系统配置 = '/api/systemSettings/save',
}
// 提示批量处理
const initOptions = { text: '加载中', success: '成功', error: '失败' }
function proxrequset(requset, options: any = initOptions) {
function proxrequest(request, options: any = initOptions) {
return async (...arg) => {
if (!options) return requset(...arg)
if (!options) return request(...arg)
const loadingInstance = ElLoading.service({ text: options.text })
try {
await requset(...arg)
await request(...arg)
ElMessage.success(options.success)
} catch (error) {
ElMessage.error(options.error)
@ -24,19 +23,25 @@ function proxrequset(requset, options: any = initOptions) {
loadingInstance.close()
}
return requset
return request
}
}
export function getSysSettingApi() {
return requset.get(Api.get系统配置)
return request.get(Api.get系统配置)
}
export const proxGetSysSettingApi = proxrequset(getSysSettingApi)
export const proxGetSysSettingApi = proxrequest(getSysSettingApi)
export const userGetInfoService = () =>
requset.get('/api/user/info', {
headers: { Authorization: `Bearer ${user.token}` },
export const userGetInfoService = (token: any) =>
request.get('/api/user/info', {
headers: { Authorization: `Bearer ${token}` },
})
//获取学生列表
export const userStudentListService = (id) => {
return request.post('/api/coursesteacher/studentList?userId=' + id)
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

@ -52,6 +52,15 @@ export const constRouter: any = [
hidden: false,
},
},
{
path: '/roadbedRecommendation',
component: () => import('@/views/roadbedRecommendation/index.vue'),
name: 'RoadbedRecommendation',
meta: {
title: '学习路径',
hidden: false,
},
},
{
path: '/pedagogicalReform', // 教学改革
component: () => import('@/views/pedagogicalReform/index.vue'),
@ -90,15 +99,6 @@ export const constRouter: any = [
hidden: true,
},
},
{
path:'/roadbedRecommendation',
component:() => import('@/views/roadbedRecommendation/index.vue'),
name:'RoadbedRecommendation',
meta: {
title: '学习推荐',
hidden: false,
},
},
// {
// path: '/talentDevelopment', // 人才培养
// component: () => import('@/views/talentDevelopment/index.vue'),

@ -1,19 +1,40 @@
import { defineStore } from 'pinia'
const userStore = defineStore('userStore', {
state() {
return {
token: 'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ4aWFvMTExMSIsImNyZWF0ZWQiOjE3MjQ2NTQxNjMxMjIsImV4cCI6MTcyNTI1ODk2M30.uIEZhGG6-XGomV0aqpamOn54VxP4ItfM_ip9EgI0ohcYPyEnln6dXBoG8eVBNlbigglIjw5V1N5bHPdIAifeaA',
import { userGetInfoService } from '@/api/configuration'
import { ref, reactive } from 'vue'
const userStore = defineStore('userStore', () => {
const userInfo = reactive<any>({})
const isLogin = ref(false)
const token = ref('eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ4aWFvMTExMSIsImNyZWF0ZWQiOjE3MjQ2NTQxNjMxMjIsImV4cCI6MTcyNTI1ODk2M30.uIEZhGG6-XGomV0aqpamOn54VxP4ItfM_ip9EgI0ohcYPyEnln6dXBoG8eVBNlbigglIjw5V1N5bHPdIAifeaA')
userGetInfoService(token.value).then(res => {
// @ts-ignore
if (res.code === 200) {
Object.assign(userInfo, res.data)
isLogin.value = true
}
},
actions: {
async verifyToken(token:string){
const res = await verifyTokenApi({token})
if(res){
this.token = token
}else{
return false
}
}
},
})
return {
token,
userInfo,
isLogin
}
})
export default userStore
// const userStore = defineStore('userStore', {
// state() {
// return {
// token: 'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ4aWFvMTExMSIsImNyZWF0ZWQiOjE3MjQ2NTQxNjMxMjIsImV4cCI6MTcyNTI1ODk2M30.uIEZhGG6-XGomV0aqpamOn54VxP4ItfM_ip9EgI0ohcYPyEnln6dXBoG8eVBNlbigglIjw5V1N5bHPdIAifeaA',
// }
// },
// actions: {
// async verifyToken(token:string){
// const res = await verifyTokenApi({token})
// if(res){
// this.token = token
// }else{
// return false
// }
// }
// },
// })
// export default userStore

@ -0,0 +1,80 @@
<script setup lang="ts">
import useUserStore from '@/store/module/user';
const userStore = useUserStore()
import { ref, watch } from 'vue';
import { userStudentListService } from '@/api/configuration';
const loading = ref(false)
const stuList: any = ref([])
const getStuList = async () => {
loading.value = true
const res = await userStudentListService(userStore.userInfo.id)
stuList.value = res.data
loading.value = false
}
watch(() => userStore.userInfo.id, () => {
getStuList()
})
import defImg from '@/assets/images/default.png'
</script>
<template>
<div class="stu-list">
<div class="stu_content" v-loading="loading">
<ul>
<li class="stu-item" v-for="(item, index) in stuList" :key="index">
<img :src="item.icon || defImg" class="stu-item-img" />
<div class="stu-item-info">
<h4 style="font-weight: bold">{{ item.name }}</h4>
<h4 style="color: #666">{{ item.number }}</h4>
</div>
</li>
</ul>
</div>
</div>
</template>
<style lang="scss" scoped>
.stu_content {
height: 86%;
overflow: hidden;
text-overflow: ellipsis;
font-family: 'Microsoft YaHei';
/* background-color: rgb(100, 100, 64); */
.stu-item {
margin-top: 20px;
/* height: 100%; */
/* border-radius: 10px; */
/* background-color: #0080ff; */
border-bottom: 1px solid #ededed;
/* border-radius: 10px; */
/* box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); */
box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.07);
display: flex;
padding: 5px;
/* margin: 10px; */
justify-content: space-between;
}
.stu-item-img {
background-color: yellow;
border-radius: 50%;
width: 40px;
height: 40px;
justify-content: center;
align-items: center;
}
.stu-item-info {
/* margin-left: 15px; */
width: 80%;
height: 40px;
background-color: #ffffff;
display: flex;
flex-direction: column;
justify-content: space-between;
}
}
</style>

@ -175,12 +175,15 @@
<div class="chapter">
<courseTree :chapterList="chapterList" />
</div>
<div class="student-list"></div>
<div class="student-list">
<stu-list></stu-list>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import StuList from './components/StuList.vue'
import { ref, nextTick } from 'vue'
import Graph from '../home/components/Graph.vue'
import courseTree from './components/courseTree.vue'

@ -1,7 +1,8 @@
<script setup lang="ts">
import { ref } from 'vue';
import { userGetInfoService } from '@/api/configuration';
import useUserStore from '@/store/module/user';
const userStore = useUserStore()
const paginationData = ref({
pageNo: 1,
pageSize: 8,
@ -55,7 +56,7 @@ const dataList = ref([
},
])
const isLogin = ref(false)
userGetInfoService().then(res => {
userGetInfoService(userStore.token).then(res => {
// @ts-ignore
if (res.code === 200) {
isLogin.value = true
@ -118,7 +119,7 @@ function skip(url: string) {
详情
</el-button>
<el-button round plain
@click="skip('http://localhost:5173/#/curriculumCenter/basicCourseInformation')">
@click="$router.push('/roadbedRecommendation')">
路径规划
</el-button>
</div>

Loading…
Cancel
Save