|
@@ -2,7 +2,10 @@
|
|
|
<div class="teacher-detail">
|
|
|
<header class="teacher-header">
|
|
|
<img :src="teacher.image" :alt="teacher.name" class="profile-image">
|
|
|
- <h1>{{ teacher.name }}</h1>
|
|
|
+ <p>
|
|
|
+ <h1>{{ teacher.name }}</h1>
|
|
|
+ <button @click="editProfile" class="edit-button" v-if="authStore.user && authStore.user.id == teacher.id">编辑资料</button>
|
|
|
+ </p>
|
|
|
</header>
|
|
|
|
|
|
<section class="basic-info">
|
|
@@ -11,17 +14,18 @@
|
|
|
<p style="white-space: pre-line"><strong>本科课程:</strong> <p></p> {{ teacher.undergraduateCourse }}</p>
|
|
|
<p style="white-space: pre-line"><strong>研究生课程:</strong> <p></p> {{ teacher.graduateCourse }}</p>
|
|
|
<p style="white-space: pre-line"><strong>研究领域:</strong> <p></p> {{ teacher.researchField }}</p>
|
|
|
+ <p style="white-space: pre-line"><strong>奖项:</strong> <p></p> {{ teacher.awards }}</p>
|
|
|
<p><strong>邮箱:</strong> {{ teacher.email }}</p>
|
|
|
<p><strong>电话:</strong> {{ teacher.phoneNumber }}</p>
|
|
|
</section>
|
|
|
|
|
|
- <section class="additional-info">
|
|
|
- <CollapsibleSection title="专利" :expanded="expandedSections.patents">
|
|
|
+ <section class="additional-info" v-if="isNotEmpty(teacher.patent) || isNotEmpty(awards) || isNotEmpty(theses) || isNotEmpty(works)">
|
|
|
+ <CollapsibleSection title="专利" :expanded="expandedSections.patents" v-if="isNotEmpty(teacher.patent)">
|
|
|
<div v-for="patent in teacher.patent" :key="patent.patentNum" class="info-item">
|
|
|
- <p><strong>专利号:</strong> {{ patent.patentNum }}</p>
|
|
|
- <p><strong>授权号:</strong> {{ patent.authorizationNum }}</p>
|
|
|
- <p><strong>证书号:</strong> {{ patent.certificateNum }}</p>
|
|
|
- <p><strong>日期:</strong> {{ patent.date }}</p>
|
|
|
+ <p v-if="isNotEmpty(patent.patentNum)"><strong>专利号:</strong> {{ patent.patentNum }}</p>
|
|
|
+ <p v-if="isNotEmpty(patent.authorizationNum)"><strong>授权号:</strong> {{ patent.authorizationNum }}</p>
|
|
|
+ <p v-if="isNotEmpty(patent.certificateNum)"><strong>证书号:</strong> {{ patent.certificateNum }}</p>
|
|
|
+ <p v-if="isNotEmpty(patent.date)"><strong>日期:</strong> {{ patent.date }}</p>
|
|
|
</div>
|
|
|
<Pagination
|
|
|
:current-page="patentPage"
|
|
@@ -31,11 +35,11 @@
|
|
|
/>
|
|
|
</CollapsibleSection>
|
|
|
|
|
|
- <CollapsibleSection title="获奖" :expanded="expandedSections.awards">
|
|
|
+ <CollapsibleSection title="获奖" :expanded="expandedSections.awards" v-if="isNotEmpty(awards)">
|
|
|
<div v-for="award in awards" :key="award.id" class="info-item">
|
|
|
<p><strong>名称:</strong> {{ award.name }}</p>
|
|
|
- <p><strong>时间:</strong> {{ award.time }}</p>
|
|
|
- <img :src="award.image" :alt="award.name" class="info-image">
|
|
|
+ <p v-if="isNotEmpty(award.time)"><strong>时间:</strong> {{ award.time }}</p>
|
|
|
+ <img v-if="isNotEmpty(award.image)" :src="award.image" :alt="award.name" class="info-image">
|
|
|
</div>
|
|
|
<Pagination
|
|
|
:current-page="awardPage"
|
|
@@ -45,13 +49,14 @@
|
|
|
/>
|
|
|
</CollapsibleSection>
|
|
|
|
|
|
- <CollapsibleSection title="论文" :expanded="expandedSections.theses">
|
|
|
+ <CollapsibleSection title="论文" :expanded="expandedSections.theses" v-if="isNotEmpty(theses)">
|
|
|
<div v-for="thesis in theses" :key="thesis.id" class="info-item">
|
|
|
<p><strong>名称:</strong> {{ thesis.name }}</p>
|
|
|
- <p><strong>发表时间:</strong> {{ thesis.time }}</p>
|
|
|
- <a :href="thesis.website" target="_blank" class="info-link">查看详情</a>
|
|
|
- <img :src="thesis.image" :alt="thesis.name" class="info-image">
|
|
|
- <a :href="thesis.file" target="_blank" class="info-link">下载文件</a>
|
|
|
+ <p v-if="isNotEmpty(thesis.time)"><strong>发表时间:</strong> {{ thesis.time }}</p>
|
|
|
+ <p v-if="isNotEmpty(thesis.website)" :href="thesis.website" target="_blank" class="info-link">查看详情</p>
|
|
|
+ <img v-if="isNotEmpty(thesis.image)" :src="thesis.image" :alt="thesis.name" class="info-image">
|
|
|
+ <div/>
|
|
|
+ <p :href="thesis.file" target="_blank" class="info-link">下载文件</p>
|
|
|
</div>
|
|
|
<Pagination
|
|
|
:current-page="thesisPage"
|
|
@@ -61,12 +66,12 @@
|
|
|
/>
|
|
|
</CollapsibleSection>
|
|
|
|
|
|
- <CollapsibleSection title="著作" :expanded="expandedSections.works">
|
|
|
+ <CollapsibleSection title="著作" :expanded="expandedSections.works" v-if="isNotEmpty(works)">
|
|
|
<div v-for="work in works" :key="work.id" class="info-item">
|
|
|
<p><strong>名称:</strong> {{ work.name }}</p>
|
|
|
- <p><strong>出版社:</strong> {{ work.press }}</p>
|
|
|
- <p><strong>出版时间:</strong> {{ work.time }}</p>
|
|
|
- <img :src="work.image" :alt="work.name" class="info-image">
|
|
|
+ <p v-if="isNotEmpty(work.press)"><strong>出版社:</strong> {{ work.press }}</p>
|
|
|
+ <p v-if="isNotEmpty(work.time)"><strong>出版时间:</strong> {{ work.time }}</p>
|
|
|
+ <img v-if="isNotEmpty(work.image)" :src="work.image" :alt="work.name" class="info-image">
|
|
|
<a :href="work.file" target="_blank" class="info-link">下载文件</a>
|
|
|
</div>
|
|
|
<Pagination
|
|
@@ -77,16 +82,18 @@
|
|
|
/>
|
|
|
</CollapsibleSection>
|
|
|
</section>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { ref, reactive, watch } from 'vue';
|
|
|
-import { useRoute } from 'vue-router';
|
|
|
+import { useRoute, useRouter } from 'vue-router';
|
|
|
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'
|
|
|
+import { isNotEmpty } from '@/utils/util';
|
|
|
+import { useAuthStore } from '../store/modules/auth';
|
|
|
|
|
|
export default {
|
|
|
name: 'TeacherDetail',
|
|
@@ -96,7 +103,9 @@ export default {
|
|
|
},
|
|
|
setup() {
|
|
|
const teachersStore = useTeachersStore();
|
|
|
+ const authStore = useAuthStore()
|
|
|
const route = useRoute();
|
|
|
+ const router = useRouter();
|
|
|
const teacherId = ref(route.params.id);
|
|
|
|
|
|
const teacher = ref({});
|
|
@@ -115,10 +124,10 @@ export default {
|
|
|
const patentTotal = ref(1);
|
|
|
|
|
|
const expandedSections = reactive({
|
|
|
- patents: false,
|
|
|
- awards: false,
|
|
|
- theses: false,
|
|
|
- works: false
|
|
|
+ patents: true,
|
|
|
+ awards: true,
|
|
|
+ theses: true,
|
|
|
+ works: true
|
|
|
});
|
|
|
|
|
|
const fetchTeacherData = async () => {
|
|
@@ -181,6 +190,10 @@ export default {
|
|
|
teacher.value.patent = teacher.value.patent.slice((page - 1) * pageSize.value, page * pageSize.value);
|
|
|
};
|
|
|
|
|
|
+ const editProfile = () => {
|
|
|
+ router.push('/editprofile');
|
|
|
+ }
|
|
|
+
|
|
|
watch(teacherId, () => {
|
|
|
fetchTeacherData();
|
|
|
fetchAwards();
|
|
@@ -203,10 +216,13 @@ export default {
|
|
|
patentPage,
|
|
|
patentTotal,
|
|
|
expandedSections,
|
|
|
+ authStore,
|
|
|
+ editProfile,
|
|
|
handleAwardPageChange,
|
|
|
handleThesisPageChange,
|
|
|
handleWorkPageChange,
|
|
|
- handlePatentPageChange
|
|
|
+ handlePatentPageChange,
|
|
|
+ isNotEmpty
|
|
|
};
|
|
|
}
|
|
|
};
|
|
@@ -229,12 +245,12 @@ export default {
|
|
|
}
|
|
|
|
|
|
.profile-image {
|
|
|
- width: 150px;
|
|
|
- height: 150px;
|
|
|
- object-fit: cover;
|
|
|
- border-radius: 50%;
|
|
|
+ width: 180px;
|
|
|
+ height: 180px;
|
|
|
+ object-fit: contain;
|
|
|
+ /* border-radius: 50%; */
|
|
|
margin-right: 2rem;
|
|
|
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
|
+ /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); */
|
|
|
}
|
|
|
|
|
|
h1 {
|
|
@@ -304,5 +320,19 @@ strong {
|
|
|
margin-top: 1.5rem;
|
|
|
}
|
|
|
|
|
|
+.edit-button, .upload-button {
|
|
|
+ margin-top: 20px;
|
|
|
+ padding: 10px 20px;
|
|
|
+ background-color: #4CAF50;
|
|
|
+ color: white;
|
|
|
+ border: none;
|
|
|
+ cursor: pointer;
|
|
|
+ text-decoration: none;
|
|
|
+ display: inline-block;
|
|
|
+}
|
|
|
+
|
|
|
+.edit-button:hover, .upload-button:hover {
|
|
|
+ background-color: #45a049;
|
|
|
+}
|
|
|
/* Add any additional styles for the CollapsibleSection and Pagination components here */
|
|
|
</style>
|