diff --git a/src/api/user/user.js b/src/api/user/user.js index ad88cd7..94c9e29 100644 --- a/src/api/user/user.js +++ b/src/api/user/user.js @@ -36,11 +36,11 @@ export const userChangeService = (jsonData) => { headers: { 'Content-Type': 'application/json;charset=UTF-8' }, }) } -//获取身份信息 +//获取个人信息 export const userIdenService = (id) => { return request.post('/api/user/personal/info?id=' + id) } -//修改身份信息 +//修改个人信息 export const userIdenChangeService = (dataToSend) => { return request.post('/api/user/update/PersonalInfo', dataToSend, { headers: { 'Content-Type': 'application/json;charset=UTF-8' }, diff --git a/src/views/home/components/Class1.vue b/src/views/home/components/Class1.vue index 2473ab3..366dd58 100644 --- a/src/views/home/components/Class1.vue +++ b/src/views/home/components/Class1.vue @@ -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" > - course image +

{{ course.name }}

{{ course.hours }}

@@ -63,7 +63,7 @@ const courses = [ .course-list { display: flex; flex-direction: column; - width: 132px; + height: 48px; } .course-item { diff --git a/src/views/home/components/Class2.vue b/src/views/home/components/Class2.vue index 64af42d..7888063 100644 --- a/src/views/home/components/Class2.vue +++ b/src/views/home/components/Class2.vue @@ -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 { diff --git a/src/views/home/components/Info.vue b/src/views/home/components/Info.vue index 2e79004..d05847d 100644 --- a/src/views/home/components/Info.vue +++ b/src/views/home/components/Info.vue @@ -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) + }) }