处理接口

develoop
ww 5 months ago
parent 5a1e2b52d3
commit 5a2d57a62a
  1. 4
      src/api/user/user.js
  2. 12
      src/views/home/components/Class1.vue
  3. 9
      src/views/home/components/Class2.vue
  4. 29
      src/views/home/components/Info.vue
  5. 9
      src/views/home/index.vue
  6. 18
      src/views/login/index.vue

@ -36,11 +36,11 @@ export const userChangeService = (jsonData) => {
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
})
}
//获取身份信息
//获取个人信息
export const userIdenService = (id) => {
return request.post('/user/personal/info?id=' + id)
}
//修改身份信息
//修改个人信息
export const userIdenChangeService = (dataToSend) => {
return request.post('/user/update/PersonalInfo', dataToSend, {
headers: { 'Content-Type': 'application/json;charset=UTF-8' },

@ -2,22 +2,22 @@
import conheader from '@/views/home/components/ConHeader.vue'
const courses = [
{
name: 'Vue.js Basics',
name: '软件构造',
image: 'vuejs-basics.jpg',
hours: 20,
},
{
name: 'Reac',
name: '软件项目管理',
image: 'react-fundamentals.jpg',
hours: 25,
},
{
name: 'Reacts',
name: 'React',
image: 'react-fundamentals.jpg',
hours: 25,
},
{
name: 'React Fund',
name: '程序设计',
image: 'react-fundamentals.jpg',
hours: 25,
},
@ -33,7 +33,7 @@ const courses = [
:key="index"
class="course-item"
>
<img :src="course.image" alt="course image" class="course-image" />
<img :src="course.image" class="course-image" />
<div class="course-info">
<p class="course-name">{{ course.name }}</p>
<p class="course-hours">{{ course.hours }}</p>
@ -63,7 +63,7 @@ const courses = [
.course-list {
display: flex;
flex-direction: column;
width: 132px;
height: 48px;
}
.course-item {

@ -2,22 +2,22 @@
import conheader from '@/views/home/components/ConHeader.vue'
const courses = [
{
name: 'Vue.js Basics',
name: '软件构造',
image: 'vuejs-basics.jpg',
hours: 20,
},
{
name: 'Reac',
name: '项目管理',
image: 'react-fundamentals.jpg',
hours: 25,
},
{
name: 'Reacts',
name: 'React',
image: 'react-fundamentals.jpg',
hours: 25,
},
{
name: 'React Fund',
name: '程序设计',
image: 'react-fundamentals.jpg',
hours: 25,
},
@ -63,7 +63,6 @@ const courses = [
.course-list {
display: flex;
flex-direction: column;
width: 132px;
height: 48px;
}
.course-item {

@ -4,12 +4,13 @@ import { onMounted, ref, computed } from 'vue'
import { userIdenChangeService } from '@/api/user/user.js'
import { Edit } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
const props = defineProps({
data: {
type: Object,
},
})
console.log(props.data, 'info')
console.log(props.data, 'djegd ')
const formModel = ref()
const loading = ref()
//true
@ -27,7 +28,6 @@ const openEditDialog = (row) => {
}
//
const saveEdit = () => {
console.log(editRowIndex.value, 'rowww')
const index = editRowIndex.value
if (index !== -1) {
formModel.value[index] = { ...editForm.value }
@ -44,9 +44,8 @@ const cancelEdit = () => {
content: '',
}
}
const identInfo = ref()
onMounted(() => {
// console.log(props.data, 'res')
if (props.data.roleId === 1) {
formModel.value = [
{ par: 'name', name: '姓名', content: props.data.name },
@ -86,8 +85,8 @@ onMounted(() => {
{ 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 },
{ par: 'yearAge', name: '入学年份', content: props.data.yearAge },
{ par: 'className', name: '班级', content: props.data.className },
]
}
// else {
@ -103,7 +102,6 @@ onMounted(() => {
// { name: '', content: 9.9 },
// ]
// }
console.log(formModel.value)
})
// 1
const drawer2 = ref(false)
@ -111,7 +109,7 @@ const direction = ref('rtl')
function cancelClick() {
drawer2.value = false
}
const data1 = ref()
const data1 = ref([])
const confirmClick = () => {
drawer2.value = false
data1.value = formModel.value
@ -119,12 +117,17 @@ const confirmClick = () => {
data1.value.map((item) => (values[item.par] = item.content))
const dataToSend = {
...values,
roleId: identInfo.value.roleId,
id: identInfo.value.id,
roleId: props.data.roleId,
id: props.data.id,
}
userIdenChangeService(dataToSend).then(() => {
ElMessage.success('修改成功')
})
console.log(dataToSend, 'datato111')
userIdenChangeService(dataToSend)
.then(() => {
ElMessage.success('修改成功')
})
.catch((error) => {
console.log(error)
})
}
</script>
<template>

@ -16,11 +16,10 @@ const infoData = ref()
const flag = ref(false)
const role = ref(null)
const rightVisible = ref(false)
const getData = async () => {
await userStore.getUserInfo().catch((error) => {
console.log(error)
})
}
userStore.getUserInfo().catch((error) => {
console.log(error)
})
onMounted(() => {
// getData()
username.value = userStore.userName

@ -385,15 +385,15 @@ onBeforeUnmount(() => {
clearInterval(timer) //
})
//
// watch(isRegister, () => {
// formModel.value = {
// username: '',
// password: '',
// repassword: '',
// phone: '',
// code: '',
// }
// })
watch(isRegister, () => {
formModel.value = {
username: '',
password: '',
repassword: '',
phone: '',
code: '',
}
})
//
watch(isToggle, () => {
formModel.value = {

Loading…
Cancel
Save