|
@@ -25,8 +25,8 @@
|
|
|
</div>
|
|
|
<Pagination
|
|
|
:current-page="patentPage"
|
|
|
- :total="patentTotal"
|
|
|
- :page-size="pageSize"
|
|
|
+ :total-items="patentTotal"
|
|
|
+ :items-per-page="pageSize"
|
|
|
@page-change="handlePatentPageChange"
|
|
|
/>
|
|
|
</CollapsibleSection>
|
|
@@ -39,8 +39,8 @@
|
|
|
</div>
|
|
|
<Pagination
|
|
|
:current-page="awardPage"
|
|
|
- :total="awardTotal"
|
|
|
- :page-size="pageSize"
|
|
|
+ :total-items="awardTotal"
|
|
|
+ :items-per-page="pageSize"
|
|
|
@page-change="handleAwardPageChange"
|
|
|
/>
|
|
|
</CollapsibleSection>
|
|
@@ -55,8 +55,8 @@
|
|
|
</div>
|
|
|
<Pagination
|
|
|
:current-page="thesisPage"
|
|
|
- :total="thesisTotal"
|
|
|
- :page-size="pageSize"
|
|
|
+ :total-items="thesisTotal"
|
|
|
+ :items-per-page="pageSize"
|
|
|
@page-change="handleThesisPageChange"
|
|
|
/>
|
|
|
</CollapsibleSection>
|
|
@@ -71,8 +71,8 @@
|
|
|
</div>
|
|
|
<Pagination
|
|
|
:current-page="workPage"
|
|
|
- :total="workTotal"
|
|
|
- :page-size="pageSize"
|
|
|
+ :total-items="workTotal"
|
|
|
+ :items-per-page="pageSize"
|
|
|
@page-change="handleWorkPageChange"
|
|
|
/>
|
|
|
</CollapsibleSection>
|
|
@@ -83,9 +83,10 @@
|
|
|
<script>
|
|
|
import { ref, reactive, watch } from 'vue';
|
|
|
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 Pagination from '@/components/Pagination.vue';
|
|
|
+import { getThesisPage, getWorksPage, getAwards } from '@/api/Open'
|
|
|
|
|
|
export default {
|
|
|
name: 'TeacherDetail',
|
|
@@ -94,6 +95,7 @@ export default {
|
|
|
Pagination
|
|
|
},
|
|
|
setup() {
|
|
|
+ const teachersStore = useTeachersStore();
|
|
|
const route = useRoute();
|
|
|
const teacherId = ref(route.params.id);
|
|
|
|
|
@@ -102,15 +104,15 @@ export default {
|
|
|
const theses = ref([]);
|
|
|
const works = ref([]);
|
|
|
|
|
|
- const pageSize = ref(10);
|
|
|
+ const pageSize = ref(12);
|
|
|
const awardPage = ref(1);
|
|
|
- const awardTotal = ref(0);
|
|
|
+ const awardTotal = ref(1);
|
|
|
const thesisPage = ref(1);
|
|
|
- const thesisTotal = ref(0);
|
|
|
+ const thesisTotal = ref(1);
|
|
|
const workPage = ref(1);
|
|
|
- const workTotal = ref(0);
|
|
|
+ const workTotal = ref(1);
|
|
|
const patentPage = ref(1);
|
|
|
- const patentTotal = ref(0);
|
|
|
+ const patentTotal = ref(1);
|
|
|
|
|
|
const expandedSections = reactive({
|
|
|
patents: false,
|
|
@@ -121,10 +123,9 @@ export default {
|
|
|
|
|
|
const fetchTeacherData = async () => {
|
|
|
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) {
|
|
|
console.error('获取教师信息失败:', error);
|
|
|
}
|
|
@@ -132,19 +133,19 @@ export default {
|
|
|
|
|
|
const fetchAwards = async () => {
|
|
|
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) {
|
|
|
console.error('获取获奖信息失败:', error);
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
const fetchTheses = async () => {
|
|
|
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) {
|
|
|
console.error('获取论文信息失败:', error);
|
|
|
}
|
|
@@ -152,9 +153,9 @@ export default {
|
|
|
|
|
|
const fetchWorks = async () => {
|
|
|
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) {
|
|
|
console.error('获取著作信息失败:', error);
|
|
|
}
|
|
@@ -167,7 +168,7 @@ export default {
|
|
|
|
|
|
const handleThesisPageChange = (page) => {
|
|
|
thesisPage.value = page;
|
|
|
- fetchTheses();
|
|
|
+ fetchThesis();
|
|
|
};
|
|
|
|
|
|
const handleWorkPageChange = (page) => {
|