ww 5 months ago
commit 1017abb695
  1. 1
      src/store/modules/type/types.ts
  2. 9
      src/store/modules/user.ts
  3. 18
      src/views/course/basicCourseInformation.vue
  4. 142
      src/views/home/components/Info.vue
  5. 2
      src/views/home/index.vue

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

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

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

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

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

Loading…
Cancel
Save