Compare commits

...

2 Commits

  1. 8770
      pnpm-lock.yaml
  2. 1
      src/store/modules/type/types.ts
  3. 9
      src/store/modules/user.ts
  4. 18
      src/views/course/basicCourseInformation.vue
  5. 142
      src/views/home/components/Info.vue
  6. 2
      src/views/home/index.vue

File diff suppressed because it is too large Load Diff

@ -6,4 +6,5 @@ export interface LoginStoreType {
avatar: string // 用户头像
routes: string
phone: string
userInfo: object
}

@ -18,6 +18,7 @@ import {
userLoginService,
userGetInfoService,
userPhoneLoginService,
userIdenService,
} from '@/api/user/user.js'
const useUserStore = defineStore(
@ -30,6 +31,7 @@ const useUserStore = defineStore(
userName: '', // 用户姓名
avatar: '', // 用户头像
routes: '',
userInfo: {}, // 当前用户相关信息
}
},
actions: {
@ -47,6 +49,7 @@ const useUserStore = defineStore(
this.token = res.data.token as string
SET_TKOEN('TOKEN', this.token)
// localStorage.setItem('TOKEN', this.token)
ElNotification({
type: 'success',
message: '登录成功!',
@ -89,7 +92,11 @@ const useUserStore = defineStore(
async getUserInfo() {
const result = await userGetInfoService(GET_TKOEN('TOKEN'))
if (result.code === 200) {
// console.log(result)
const res = await userIdenService(result.data.id)
this.userInfo = res.data
console.log(this.userInfo, 'this.userInfo')
console.log(result, '123')
this.userName = result.data.username
// this.avatar = result.data.checkUser.avatar
this.routes = result.data.menus.map((item) => {

@ -11,6 +11,10 @@ import {
import { ElMessageBox, ElMessage } from 'element-plus'
// import router from '@/router'
import { useRouter } from 'vue-router'
import useUserStore from '@/store/modules/user'
// import { useRoute } from 'vue-router'
const userStore = useUserStore()
// const userInfo = userStore.userInfo
const router = useRouter()
// const route = useRoute()
// console.log(route)
@ -29,7 +33,7 @@ const total = ref(0)
const params = ref({
pageNo: 1,
pageSize: 7,
username: 'qiu',
username: userStore.userName,
assessmenttype: '',
category: '',
nature: '',
@ -39,12 +43,14 @@ const loading = ref(false)
//
const getCourseList = async () => {
loading.value = true
console.log(params.value, '11')
const res = await getCourseListApi(params.value)
// console.log(res)
courseList.value = res.data.list
total.value = res.data.total
console.log(res.data.list)
loading.value = false
// console.log(userStore.userName, '1111')
}
//
onMounted(() => {
@ -161,7 +167,7 @@ const CloseCouresNameChangeEvent = () => {
<div class="btn">
<!-- <el-button type="primary" round size="large">全部课程</el-button>
<el-button type="primary" round plain size="large">我的文件夹</el-button> -->
<el-form inline>
<el-form inline v-if="userStore.userInfo.roleId === 1">
<el-form-item label="课程教师:" class="short-form-item">
<el-select v-model="params.teacher">
<el-option
@ -198,7 +204,11 @@ const CloseCouresNameChangeEvent = () => {
</el-form>
<div class="course">
<ul class="course_list">
<li @click="onAddCourse()" class="add_course">
<li
v-if="userStore.userInfo.roleId === 1"
@click="onAddCourse()"
class="add_course"
>
<div class="plus">
<el-icon class="avatar-uploader-icon">
<Plus />

@ -46,80 +46,80 @@ const cancelEdit = () => {
}
const identInfo = ref()
//
const getInfo = async (id) => {
const res = await userIdenService(id)
identInfo.value = res
return res
}
// const getInfo = async (id) => {
// const res = await userIdenService(id)
// identInfo.value = res
// return res
// }
console.log()
onMounted(() => {
// getInfo(id)
getInfo(id)
.then((res) => {
// 访 getData
console.log(res.data, '000000')
identInfo.value = res.data
//
if (res.data.roleId === 1) {
formModel.value = [
{ par: 'name', name: '姓名', content: res.data.name },
{ par: 'sex', name: '性别', content: res.data.sex },
{ par: 'nationality', name: '民族', content: res.data.nationality },
{ par: 'profession', name: '专业', content: res.data.profession },
{ par: 'education', name: '学历', content: res.data.education },
{ par: 'degree', name: '学位', content: res.data.degree },
{
par: 'professionalTitle',
name: '职称',
content: res.data.professionalTitle,
},
{
par: 'emergencyContact',
name: '手机号',
content: res.data.emergencyContact,
},
{
par: 'joinWorkTime',
name: '参加工作时间',
content: res.data.joinWorkTime,
},
{
par: 'politicalStatus',
name: '政治面貌',
content: res.data.politicalStatus,
},
]
} else if (res.data.roleId === 2) {
formModel.value = [
{ par: 'name', name: '姓名', content: res.data.name },
{ par: 'sex', name: '性别', content: res.data.sex },
{ par: 'nationality', name: '民族', content: res.data.nationality },
{ par: 'number', name: '学号', content: res.data.number },
{ par: 'birthday', name: '生日', content: res.data.birthday },
{ par: 'phone', name: '手机号', content: res.data.phone },
{ par: 'faculty', name: '院系', content: res.data.faculty },
{ par: 'major', name: '专业', content: res.data.major },
{ par: 'year_age', name: '入学年份', content: res.data.year_age },
{ par: 'class_name', name: '班级', content: res.data.class_name },
]
}
// else {
// formModel.value = [
// { name: '', content: res.data.name },
// { name: '', content: res.data.id },
// { name: '', content: 9.9 },
// { name: '', content: 9.9 },
// { name: '', content: 9.9 },
// { name: '', content: 9.9 },
// { name: '', content: 9.9 },
// { name: '', content: 9.9 },
// { name: '', content: 9.9 },
// ]
// }
})
.catch((error) => {
console.error(error)
})
// getInfo(id)
// .then((res) => {
// // 访 getData
// console.log(res.data, '000000')
// identInfo.value = res.data
// //
// if (res.data.roleId === 1) {
// formModel.value = [
// { par: 'name', name: '', content: res.data.name },
// { par: 'sex', name: '', content: res.data.sex },
// { par: 'nationality', name: '', content: res.data.nationality },
// { par: 'profession', name: '', content: res.data.profession },
// { par: 'education', name: '', content: res.data.education },
// { par: 'degree', name: '', content: res.data.degree },
// {
// par: 'professionalTitle',
// name: '',
// content: res.data.professionalTitle,
// },
// {
// par: 'emergencyContact',
// name: '',
// content: res.data.emergencyContact,
// },
// {
// par: 'joinWorkTime',
// name: '',
// content: res.data.joinWorkTime,
// },
// {
// par: 'politicalStatus',
// name: '',
// content: res.data.politicalStatus,
// },
// ]
// } else if (res.data.roleId === 2) {
// formModel.value = [
// { par: 'name', name: '', content: res.data.name },
// { par: 'sex', name: '', content: res.data.sex },
// { par: 'nationality', name: '', content: res.data.nationality },
// { par: 'number', name: '', content: res.data.number },
// { par: 'birthday', name: '', content: res.data.birthday },
// { par: 'phone', name: '', content: res.data.phone },
// { par: 'faculty', name: '', content: res.data.faculty },
// { par: 'major', name: '', content: res.data.major },
// { par: 'year_age', name: '', content: res.data.year_age },
// { par: 'class_name', name: '', content: res.data.class_name },
// ]
// }
// // else {
// // formModel.value = [
// // { name: '', content: res.data.name },
// // { name: '', content: res.data.id },
// // { name: '', content: 9.9 },
// // { name: '', content: 9.9 },
// // { name: '', content: 9.9 },
// // { name: '', content: 9.9 },
// // { name: '', content: 9.9 },
// // { name: '', content: 9.9 },
// // { name: '', content: 9.9 },
// // ]
// // }
// })
// .catch((error) => {
// console.error(error)
// })
})
// 1
const drawer2 = ref(false)

@ -32,7 +32,7 @@ const getData = async () => {
} else {
rightVisible.value = false
}
// console.log(data.value.roles[0], 333333)
console.log(data.value, 333333)
})
.catch((error) => {
console.log(error)

Loading…
Cancel
Save