修改接口调用

develoop
ww 5 months ago
parent 1017abb695
commit 79505bbd4c
  1. 1
      src/store/modules/type/types.ts
  2. 7
      src/store/modules/user.ts
  3. 3
      src/views/courseResources/index.vue
  4. 4
      src/views/home/components/Class1.vue
  5. 4
      src/views/home/components/Class2.vue
  6. 136
      src/views/home/components/Info.vue
  7. 8
      src/views/home/components/Status.vue
  8. 2
      src/views/home/components/Student1.vue
  9. 2
      src/views/home/components/Student2.vue
  10. 51
      src/views/home/index.vue

@ -7,4 +7,5 @@ export interface LoginStoreType {
routes: string
phone: string
userInfo: object
data: object
}

@ -32,12 +32,13 @@ const useUserStore = defineStore(
avatar: '', // 用户头像
routes: '',
userInfo: {}, // 当前用户相关信息
data: {},
}
},
actions: {
// 登录事件
async userLogin(data: loginType) {
console.log(data, 'pinia')
// console.log(data, 'pinia')
const res: loginResponseType = await userLoginService(data).catch(
(error) => {
ElMessage.error(error.response.data.message)
@ -94,8 +95,8 @@ const useUserStore = defineStore(
if (result.code === 200) {
const res = await userIdenService(result.data.id)
this.userInfo = res.data
console.log(this.userInfo, 'this.userInfo')
// 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

@ -268,11 +268,8 @@ ul {
li {
transition: filter 0.3s; /* 添加过渡动画 */
flex: 0 0 20%;
<<<<<<< HEAD
=======
flex-direction: column;
align-items: center;
>>>>>>> f6dea2720fd0ad6ab62f53607d894cd0c406cb6d
margin-bottom: 10px;
padding: 10px;
box-sizing: border-box;

@ -24,9 +24,9 @@ const courses = [
]
</script>
<template>
<div class="info_container" style="width: 214px; height: 326px">
<div class="info_container" style="width: 90%; height: 326px">
<conheader title="已开科目"></conheader>
<div class="info_content" style="width: 214px; height: 264px">
<div class="info_content" style="width: 100%; height: 264px">
<div class="course-list">
<div
v-for="(course, index) in courses"

@ -24,9 +24,9 @@ const courses = [
]
</script>
<template>
<div class="info_container" style="width: 214px; height: 326px">
<div class="info_container" style="width: 90%; height: 326px">
<conheader title="我的科目"></conheader>
<div class="info_content" style="width: 214px; height: 264px">
<div class="info_content" style="width: 100%; height: 264px">
<div class="course-list">
<div
v-for="(course, index) in courses"

@ -1,7 +1,7 @@
<script setup>
import conheader from '@/views/home/components/ConHeader.vue'
import { onMounted, ref, computed } from 'vue'
import { userIdenService, userIdenChangeService } from '@/api/user/user.js'
import { userIdenChangeService } from '@/api/user/user.js'
import { Edit } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
const props = defineProps({
@ -9,7 +9,7 @@ const props = defineProps({
type: Object,
},
})
const id = props.data.id
console.log(props.data, 'info')
const formModel = ref()
const loading = ref()
//true
@ -45,81 +45,65 @@ const cancelEdit = () => {
}
}
const identInfo = ref()
//
// 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)
// })
// console.log(props.data, 'res')
if (props.data.roleId === 1) {
formModel.value = [
{ par: 'name', name: '姓名', content: props.data.name },
{ par: 'sex', name: '性别', content: props.data.sex },
{ par: 'nationality', name: '民族', content: props.data.nationality },
{ par: 'profession', name: '专业', content: props.data.profession },
{ par: 'education', name: '学历', content: props.data.education },
{ par: 'degree', name: '学位', content: props.data.degree },
{
par: 'professionalTitle',
name: '职称',
content: props.data.professionalTitle,
},
{
par: 'emergencyContact',
name: '手机号',
content: props.data.emergencyContact,
},
{
par: 'joinWorkTime',
name: '参加工作时间',
content: props.data.joinWorkTime,
},
{
par: 'politicalStatus',
name: '政治面貌',
content: props.data.politicalStatus,
},
]
} else if (props.data.roleId === 2) {
formModel.value = [
{ par: 'name', name: '姓名', content: props.data.name },
{ par: 'sex', name: '性别', content: props.data.sex },
{ par: 'nationality', name: '民族', content: props.data.nationality },
{ par: 'number', name: '学号', content: props.data.number },
{ par: 'birthday', name: '生日', content: props.data.birthday },
{ par: 'phone', name: '手机号', content: props.data.phone },
{ par: 'faculty', name: '院系', content: props.data.faculty },
{ par: 'major', name: '专业', content: props.data.major },
{ par: 'year_age', name: '入学年份', content: props.data.year_age },
{ par: 'class_name', name: '班级', content: props.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 },
// ]
// }
console.log(formModel.value)
})
// 1
const drawer2 = ref(false)

@ -9,7 +9,8 @@ const props = defineProps({
type: Object,
},
})
// console.log(props.data.icon, 44444)
// const data = ref(props.data, 'dsfd')
console.log(props.data, 44444)
const imageUrl = ref('')
//
const form = ref()
@ -61,11 +62,6 @@ const openFileInput = () => {
input.click()
document.body.removeChild(input)
}
const upload = async (option) => {
const res = await tool.oss.upload(option.file)
imageUrl.value = res.url
console.log(imageUrl.value)
}
//
const changeInfo = async () => {
const userInfo = {

@ -16,7 +16,7 @@ function confirmClick() {
}
</script>
<template>
<div class="info_container" style="width: 222px; height: 174px">
<div class="info_container" style="width: 90%; height: 174px">
<conheader title="学生分组" v-model="drawer2">
<div>编辑</div>
<template #drawer>

@ -16,7 +16,7 @@ function confirmClick() {
}
</script>
<template>
<div class="info_container" style="width: 222px; height: 174px">
<div class="info_container" style="width: 90%; height: 174px">
<conheader title="已分组别" v-model="drawer2">
<div>编辑</div>
<template #drawer>

@ -9,39 +9,34 @@ import Class2 from './components/Class2.vue'
import Student2 from './components/Student2.vue'
import useUserStore from '@/store/modules/user'
import { ref, onMounted } from 'vue'
import { toRaw } from 'vue'
const userStore = useUserStore()
// const info = userStore.getUserInfo()
// userStore.userInfo
// console.log(info)
const username = ref()
const data = ref(null)
const data = ref({})
const infoData = ref()
const flag = ref(false)
const role = ref(null)
const rightVisible = ref(false)
const getData = async () => {
await userStore
.getUserInfo()
.then((response) => {
const res = toRaw(response.result.data)
username.value = res.username
data.value = res
flag.value = true
role.value = data.value.roles[0]
if (role.value === '老师') {
rightVisible.value = true
} else {
rightVisible.value = false
}
console.log(data.value, 333333)
})
.catch((error) => {
console.log(error)
})
await userStore.getUserInfo().catch((error) => {
console.log(error)
})
}
onMounted(() => {
getData()
// getData()
username.value = userStore.userName
data.value = userStore.data
infoData.value = userStore.userInfo
// console.log(data.value, '11111')
// console.log(userStore.userInfo, '22222')
// console.log(userStore, 'userStore')
username.value = data.value.username
flag.value = true
role.value = data.value.roles[0]
if (role.value === '老师') {
rightVisible.value = true
} else {
rightVisible.value = false
}
})
</script>
<template>
@ -51,7 +46,7 @@ onMounted(() => {
<welcome :username="username"></welcome>
</div>
<div class="info" style="width: 100%; height: 368px">
<Info :data="data" v-if="flag"></Info>
<Info :data="infoData" v-if="flag"></Info>
</div>
<div class="echarts" style="width: 100%; height: 444px">
<echarts></echarts>
@ -59,10 +54,10 @@ onMounted(() => {
</div>
<div v-if="rightVisible" class="right">
<status :data="data" v-if="flag"></status>
<div class="class" style="width: 278px; height: 388px">
<div class="class" style="width: 100%; height: 388px">
<Class1></Class1>
</div>
<div class="stu" style="width: 278px; height: 236px">
<div class="stu" style="width: 100%; height: 236px">
<Student1></Student1>
</div>
</div>

Loading…
Cancel
Save