|
@@ -25,8 +25,8 @@
|
|
</div>
|
|
</div>
|
|
<Pagination
|
|
<Pagination
|
|
:current-page="patentPage"
|
|
:current-page="patentPage"
|
|
- :total="patentTotal"
|
|
|
|
- :page-size="pageSize"
|
|
|
|
|
|
+ :total-items="patentTotal"
|
|
|
|
+ :items-per-page="pageSize"
|
|
@page-change="handlePatentPageChange"
|
|
@page-change="handlePatentPageChange"
|
|
/>
|
|
/>
|
|
</CollapsibleSection>
|
|
</CollapsibleSection>
|
|
@@ -39,8 +39,8 @@
|
|
</div>
|
|
</div>
|
|
<Pagination
|
|
<Pagination
|
|
:current-page="awardPage"
|
|
:current-page="awardPage"
|
|
- :total="awardTotal"
|
|
|
|
- :page-size="pageSize"
|
|
|
|
|
|
+ :total-items="awardTotal"
|
|
|
|
+ :items-per-page="pageSize"
|
|
@page-change="handleAwardPageChange"
|
|
@page-change="handleAwardPageChange"
|
|
/>
|
|
/>
|
|
</CollapsibleSection>
|
|
</CollapsibleSection>
|
|
@@ -55,8 +55,8 @@
|
|
</div>
|
|
</div>
|
|
<Pagination
|
|
<Pagination
|
|
:current-page="thesisPage"
|
|
:current-page="thesisPage"
|
|
- :total="thesisTotal"
|
|
|
|
- :page-size="pageSize"
|
|
|
|
|
|
+ :total-items="thesisTotal"
|
|
|
|
+ :items-per-page="pageSize"
|
|
@page-change="handleThesisPageChange"
|
|
@page-change="handleThesisPageChange"
|
|
/>
|
|
/>
|
|
</CollapsibleSection>
|
|
</CollapsibleSection>
|
|
@@ -71,8 +71,8 @@
|
|
</div>
|
|
</div>
|
|
<Pagination
|
|
<Pagination
|
|
:current-page="workPage"
|
|
:current-page="workPage"
|
|
- :total="workTotal"
|
|
|
|
- :page-size="pageSize"
|
|
|
|
|
|
+ :total-items="workTotal"
|
|
|
|
+ :items-per-page="pageSize"
|
|
@page-change="handleWorkPageChange"
|
|
@page-change="handleWorkPageChange"
|
|
/>
|
|
/>
|
|
</CollapsibleSection>
|
|
</CollapsibleSection>
|
|
@@ -83,9 +83,10 @@
|
|
<script>
|
|
<script>
|
|
import { ref, reactive, watch } from 'vue';
|
|
import { ref, reactive, watch } from 'vue';
|
|
import { useRoute } from 'vue-router';
|
|
import { useRoute } from 'vue-router';
|
|
-import { getTeacherById, getAwardById, getThesisById, getWorkById } from '@/api/Teacher';
|
|
|
|
|
|
+import { useTeachersStore } from '@/store/modules/teachers';
|
|
import CollapsibleSection from '@/components/CollapsibleSection.vue';
|
|
import CollapsibleSection from '@/components/CollapsibleSection.vue';
|
|
import Pagination from '@/components/Pagination.vue';
|
|
import Pagination from '@/components/Pagination.vue';
|
|
|
|
+import { getThesisPage, getWorksPage, getAwards } from '@/api/Open'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: 'TeacherDetail',
|
|
name: 'TeacherDetail',
|
|
@@ -94,6 +95,7 @@ export default {
|
|
Pagination
|
|
Pagination
|
|
},
|
|
},
|
|
setup() {
|
|
setup() {
|
|
|
|
+ const teachersStore = useTeachersStore();
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
const teacherId = ref(route.params.id);
|
|
const teacherId = ref(route.params.id);
|
|
|
|
|
|
@@ -102,15 +104,15 @@ export default {
|
|
const theses = ref([]);
|
|
const theses = ref([]);
|
|
const works = ref([]);
|
|
const works = ref([]);
|
|
|
|
|
|
- const pageSize = ref(10);
|
|
|
|
|
|
+ const pageSize = ref(12);
|
|
const awardPage = ref(1);
|
|
const awardPage = ref(1);
|
|
- const awardTotal = ref(0);
|
|
|
|
|
|
+ const awardTotal = ref(1);
|
|
const thesisPage = ref(1);
|
|
const thesisPage = ref(1);
|
|
- const thesisTotal = ref(0);
|
|
|
|
|
|
+ const thesisTotal = ref(1);
|
|
const workPage = ref(1);
|
|
const workPage = ref(1);
|
|
- const workTotal = ref(0);
|
|
|
|
|
|
+ const workTotal = ref(1);
|
|
const patentPage = ref(1);
|
|
const patentPage = ref(1);
|
|
- const patentTotal = ref(0);
|
|
|
|
|
|
+ const patentTotal = ref(1);
|
|
|
|
|
|
const expandedSections = reactive({
|
|
const expandedSections = reactive({
|
|
patents: false,
|
|
patents: false,
|
|
@@ -121,10 +123,9 @@ export default {
|
|
|
|
|
|
const fetchTeacherData = async () => {
|
|
const fetchTeacherData = async () => {
|
|
try {
|
|
try {
|
|
- const response = await getTeacherById(teacherId.value);
|
|
|
|
- teacher.value = response.data;
|
|
|
|
- console.log(teacher.value)
|
|
|
|
- patentTotal.value = teacher.value.patent ? teacher.value.patent.length : 0;
|
|
|
|
|
|
+ await teachersStore.fetchTeacherDetails(teacherId.value); // 调用 Pinia 方法
|
|
|
|
+ teacher.value = teachersStore.currentTeacher; // 从 store 获取教师信息
|
|
|
|
+ patentTotal.value = teacher.value.patent ? teacher.value.patent.length : 0; // 计算专利数量
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.error('获取教师信息失败:', error);
|
|
console.error('获取教师信息失败:', error);
|
|
}
|
|
}
|
|
@@ -132,19 +133,19 @@ export default {
|
|
|
|
|
|
const fetchAwards = async () => {
|
|
const fetchAwards = async () => {
|
|
try {
|
|
try {
|
|
- const response = await getAwardById(teacherId.value, awardPage.value, pageSize.value);
|
|
|
|
- awards.value = response.records;
|
|
|
|
- awardTotal.value = response.total;
|
|
|
|
|
|
+ const response = await getAwards(awardPage.value, 12, null, teacherId.value);
|
|
|
|
+ awards.value = response.data.records;
|
|
|
|
+ awardTotal.value = response.data.total;
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.error('获取获奖信息失败:', error);
|
|
console.error('获取获奖信息失败:', error);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
-
|
|
|
|
|
|
+
|
|
const fetchTheses = async () => {
|
|
const fetchTheses = async () => {
|
|
try {
|
|
try {
|
|
- const response = await getThesisById(teacherId.value, thesisPage.value, pageSize.value);
|
|
|
|
- theses.value = response.records;
|
|
|
|
- thesisTotal.value = response.total;
|
|
|
|
|
|
+ const response = await getThesisPage(thesisPage.value, 12, null, teacherId.value);
|
|
|
|
+ theses.value = response.data.records;
|
|
|
|
+ thesisTotal.value = response.data.total;
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.error('获取论文信息失败:', error);
|
|
console.error('获取论文信息失败:', error);
|
|
}
|
|
}
|
|
@@ -152,9 +153,9 @@ export default {
|
|
|
|
|
|
const fetchWorks = async () => {
|
|
const fetchWorks = async () => {
|
|
try {
|
|
try {
|
|
- const response = await getWorkById(teacherId.value, workPage.value, pageSize.value);
|
|
|
|
- works.value = response.records;
|
|
|
|
- workTotal.value = response.total;
|
|
|
|
|
|
+ const response = await getWorksPage(workPage.value, 12, null, teacherId.value);
|
|
|
|
+ works.value = response.data.records;
|
|
|
|
+ workTotal.value = response.data.total;
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.error('获取著作信息失败:', error);
|
|
console.error('获取著作信息失败:', error);
|
|
}
|
|
}
|
|
@@ -167,7 +168,7 @@ export default {
|
|
|
|
|
|
const handleThesisPageChange = (page) => {
|
|
const handleThesisPageChange = (page) => {
|
|
thesisPage.value = page;
|
|
thesisPage.value = page;
|
|
- fetchTheses();
|
|
|
|
|
|
+ fetchThesis();
|
|
};
|
|
};
|
|
|
|
|
|
const handleWorkPageChange = (page) => {
|
|
const handleWorkPageChange = (page) => {
|