Просмотр исходного кода

Merge remote-tracking branch 'origin/seec' into seec

DingXiaoYu 3 лет назад
Родитель
Сommit
a8d4c89ddc

+ 10 - 8
src/api/communication.js

@@ -4,33 +4,35 @@ const prefix = "/communication";
 
 function getAllCommunications(payload) {
     const {page, size, sort} = payload;
-    // return axios.get("https://www.fastmock.site/mock/7626b3aeb545b939cbf526e8fcfda744/api/communications", {params: {userId, page, size, sort}});
      return axios.get(`${prefix}`, {params: {page, size, sort}});
 
 }
 
 function getCommunicationStarers(communicationId) {
-    return axios.get(`https://www.fastmock.site/mock/7626b3aeb545b939cbf526e8fcfda744/api/communications/${communicationId}/stars/users`);
+    return axios.get(`${prefix}/${communicationId}/stars/users`);
 }
 
 function getCommunicationDetail(communicationId) {
-    return axios.get(`https://www.fastmock.site/mock/7626b3aeb545b939cbf526e8fcfda744/api/communications/${communicationId}`);
+    return axios.get(`${prefix}/${communicationId}`);
+
 }
 
-function getUserPublishCommunication(userId,page,size){
-    return axios.get(`${prefix}/users/${userId}`,{params:{page,size}});
+function getUserPublishCommunication(payload){
+    const {userId, page, size, sort} = payload;
+    return axios.get(`${prefix}/users/${userId}`,{params:{page, size, sort}});
 }
 
 function starCommunication(userId,communicationId){
-    return axios.post(`${prefix}/${communicationId}/stars`,{params:{userId}});
+    return axios.post(`${prefix}/${communicationId}/stars?userId=${userId}`);
 }
 
 function cancelStarCommunication(userId,communicationId){
     return axios.delete(`${prefix}/${communicationId}/stars`,{params:{userId}});
 }
 
-function getStarredCommunication(userId,page,size){
-    return axios.get(`${prefix}/stars/users/${userId}`,{params:{page,size}});
+function getStarredCommunication(payload){
+    const {userId, page, size, sort} = payload;
+    return axios.get(`${prefix}/stars/users/${userId}`,{params:{page, size, sort}});
 }
 
 function uploadFile(file){

+ 5 - 0
src/router/index.js

@@ -162,6 +162,11 @@ const routes = [
         name: "CommunicationManage",
         component: ()=>import("../views/CommunicationPage/ManagePage.vue")
       },
+      {
+        path:"star",
+        name: "CommunicationStar",
+        component: ()=>import("../views/CommunicationPage/StarPage.vue")
+      },
       {
         path:"communicationDetail/:communicationId",
         name: "CommunicationDetail",

+ 17 - 177
src/views/CommunicationPage/CommunicationDetail.vue

@@ -13,7 +13,8 @@
             <div class="course-info-main">
               <el-row>发布作者: {{ communicationInfo.publisherName }}</el-row>
               <el-row>所属组织: {{ communicationInfo.organization }}</el-row>
-              <el-row>持续时间: {{ communicationInfo.publishTime }}~{{ communicationInfo.deadline }}</el-row>
+              <el-row>持续时间:</el-row>
+              <el-row style="text-indent: 1em"> {{ publishTime }}~{{ deadline }}</el-row>
             </div>
             <div class="explore-item-star" >
               <el-tooltip placement="top-start" effect="light">
@@ -21,8 +22,8 @@
                   <p style="max-width:500px;">{{starersListString}}收藏了本交流</p>
                 </template>
                 <div>
-                  <el-icon v-if="communicationInfo.starred===true" style="font-size: 20px" @click="star()"><Star /></el-icon>
-                  <el-icon v-if="communicationInfo.starred===false" style="font-size: 20px;color: orange" @click="cancelStar()">
+                  <el-icon v-if="communicationInfo.starred===false" style="font-size: 20px" @click="star()"><Star /></el-icon>
+                  <el-icon v-if="communicationInfo.starred===true" style="font-size: 20px;color: orange" @click="cancelStar()">
                     <StarFilled />
                   </el-icon>
                 </div>
@@ -78,6 +79,8 @@ export default {
       attachments: [],
       starersList: [],
       starersListString: "",
+      publishTime: "",
+      deadline: ""
     };
   },
   async mounted() {
@@ -85,16 +88,21 @@ export default {
   },
   methods: {
     fetchData(){
-      this.$apis.getCommunicationDetail(this.$route.params.id).then(res=>{
+      this.$apis.getCommunicationDetail(this.$route.params.communicationId).then(res=>{
         this.communicationInfo = res.data.data;
-        this.communicationInfo.img = this.communicationInfo.photos[0].fileUrl;
+        if (this.communicationInfo.photos.length != 0){
+          this.communicationInfo.img = this.communicationInfo.photos[0].fileUrl;
+        }
+        else this.communicationInfo.img = this.$variables.noImgUrl;
         this.attachments = this.communicationInfo.attachments;
+        this.publishTime = this.communicationInfo.publishTime.substring(0,10) + " " + this.communicationInfo.publishTime.substring(11,19);
+        this.deadline = this.communicationInfo.deadline.substring(0,10) + " " + this.communicationInfo.deadline.substring(11,19);
       });
-      this.$apis.getCommunicationStarers(this.$route.params.id).then(starRes=>{
+      this.$apis.getCommunicationStarers(this.$route.params.communicationId).then(starRes=>{
             this.starersList = starRes.data.data;
             this.starersListString = "";
             this.starersList.forEach(starer=>{
-              this.starersListString = this.starersListString + starer.userName + ",";
+              this.starersListString = this.starersListString + starer.username + ",";
             });
             if (this.starersListString === ""){
               this.starersListString = "暂无用户";
@@ -104,10 +112,12 @@ export default {
     },
     star(){
       this.communicationInfo.starred = !this.communicationInfo.starred;
+      this.$apis.starCommunication(this.$store.state.user.id, this.communicationInfo.id);
       ElMessage.success("收藏成功");
     },
     cancelStar(){
       this.communicationInfo.starred = !this.communicationInfo.starred;
+      this.$apis.cancelStarCommunication(this.$store.state.user.id, this.communicationInfo.id);
       ElMessage.success("取消收藏成功");
     },
     downloadAttachment(){
@@ -148,25 +158,6 @@ export default {
   margin-top: 32px;
 }
 
-
-.flex-center {
-  display: flex;
-  justify-content: center;
-  align-items: center;
-}
-
-.flex-around {
-  display: flex;
-  align-items: center;
-  justify-content: space-around;
-}
-
-.flex-between {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-}
-
 .header {
   display: flex;
   justify-content: flex-start;
@@ -236,70 +227,6 @@ export default {
   font-size: 20px;
 }
 
-
-.course-tabs {
-  display: flex;
-  justify-content: space-between;
-}
-
-.course-tab-content {
-  margin-top: 32px;
-}
-
-
-.sel-notice-type {
-  display: flex;
-  align-items: center;
-  height: 45px;
-  justify-content: space-around;
-}
-
-.sel-project-type {
-  display: flex;
-  align-items: center;
-  height: 45px;
-  justify-content: space-around;
-}
-
-.project-type-icon {
-  border-radius: 24px;
-  border: 2px solid;
-  box-sizing: border-box;
-  padding: 4px 12px;
-  font-size: 14px;
-}
-
-.project-type-txt {
-  font-size: 14px;
-  cursor: pointer;
-}
-
-
-.notice-type-icon {
-  border-radius: 24px;
-  border: 2px solid;
-  box-sizing: border-box;
-  padding: 4px 12px;
-  font-size: 14px;
-}
-
-
-.notice-type-txt {
-  font-size: 14px;
-  cursor: pointer;
-}
-
-.el-dialog__title {
-  font-size: 22px;
-}
-
-.new-notice-content {
-  width: 100%;
-  padding: 0 24px;
-  box-sizing: border-box;
-  overflow: hidden;
-}
-
 .new-notice-content .new-notice-item {
   height: 40px;
   margin-bottom: 16px;
@@ -309,31 +236,10 @@ export default {
   font-size: 16px;
 }
 
-.content-description-area {
-  height: 100px;
-  box-sizing: border-box;
-  padding-top: 6px;
-  margin-bottom: 16px;
-  display: flex;
-  justify-content: flex-start;
-  font-size: 16px;
-
-}
-
-.new-notice-item:last-child {
-  margin-bottom: 0;
-}
-
-
 .new-notice-item > span, .content-description-area > span {
   min-width: 100px;
 }
 
-.flex-vc {
-  display: flex;
-  align-items: center;
-}
-
 .new-notice-item .mini-name-icon {
   margin-left: 16px;
   border-radius: 50%;
@@ -344,70 +250,4 @@ export default {
   color: white;
 
 }
-
-.new-notice-btn {
-  display: flex;
-  justify-content: center;
-  margin-top: 32px;
-}
-
-
-
-.task-title {
-  font-weight: bold;
-}
-
-.task-info {
-  padding: 5px 0 0 5px;
-}
-
-#eval-button:hover {
-  font-size: 17px
-}
-
-#coder-button:hover {
-  font-size: 17px;
-}
-
-.comment {
-  margin: 30px 0 0 30px;
-}
-
-.comment-child {
-  padding: 20px 0 0 30px;
-}
-
-.reply-button {
-  padding: 2px;
-  border-radius: 4px;
-  margin-left: 20px;
-  font-size: small;
-  cursor: pointer;
-  color: #808080;
-}
-
-.reply-button:hover {
-  background: #a5d1ff;
-}
-
-.announcement-content {
-  font-size: 16px;
-  padding: 10px 0 0 20px;
-  white-space: pre-wrap;
-}
-
-.el-timeline-item {
-  padding-top: 10px;
-  padding-bottom: 10px;
-  border-radius: 6px;
-  cursor: pointer;
-}
-
-.el-timeline-item:hover {
-  background-color: #F0F0F0;
-}
-
-.timeline-content{
-  margin-right: 10px;
-}
 </style>

+ 7 - 1
src/views/CommunicationPage/CommunicationPage.vue

@@ -21,7 +21,13 @@
             </el-icon>
             <span style="padding-left: 20px">发布交流</span>
           </el-menu-item>
-          <el-menu-item index="3" @click="toPage('CommunicationManage')">
+          <el-menu-item index="3" @click="toPage('CommunicationStar')">
+            <el-icon>
+              <Star/>
+            </el-icon>
+            <span style="padding-left: 20px">我的收藏</span>
+          </el-menu-item>
+          <el-menu-item index="4" @click="toPage('CommunicationManage')">
             <el-icon>
               <User/>
             </el-icon>

+ 14 - 17
src/views/CommunicationPage/ExplorePage.vue

@@ -1,13 +1,13 @@
 <template>
     <div class="communication-explore">
         <div class="explore-header">
-            <div class="explore-selector">
-                <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选
-                </el-checkbox>
-                <el-checkbox-group v-model="checkedTypes" @change="handleCheckedTypesChange">
-                    <el-checkbox v-for="type in types" :label="type" :key="type">{{ type }}</el-checkbox>
-                </el-checkbox-group>
-            </div>
+<!--            <div class="explore-selector">-->
+<!--                <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选-->
+<!--                </el-checkbox>-->
+<!--                <el-checkbox-group v-model="checkedTypes" @change="handleCheckedTypesChange">-->
+<!--                    <el-checkbox v-for="type in types" :label="type" :key="type">{{ type }}</el-checkbox>-->
+<!--                </el-checkbox-group>-->
+<!--            </div>-->
 
           <div class="explore-sorter">
             <el-select class="sort-select" style="width: 150px;" placeholder="排序方式"
@@ -26,10 +26,10 @@
             </el-select>
           </div>
 
-          <div class="explore-search">
-                <el-input placeholder="请输入搜索内容" v-model="content"></el-input>
-                <el-button type="primary" style="margin-left: 10px">确认</el-button>
-            </div>
+<!--          <div class="explore-search">-->
+<!--                <el-input placeholder="请输入搜索内容" v-model="content"></el-input>-->
+<!--                <el-button type="primary" style="margin-left: 10px">确认</el-button>-->
+<!--          </div>-->
         </div>
         <div class="explore-main">
             <ExploreItem class="explore-item"
@@ -87,9 +87,8 @@ export default {
         sort: this.sort
       };
       this.$apis.getAllCommunications(payload).then(res=>{
-        console.log(res.data);
         this.communicationList = res.data.data.content;
-        this.total = this.communicationList.length;
+        this.total = res.data.data.totalElements;
       });
     },
     handleCheckAllChange(val) {
@@ -102,7 +101,7 @@ export default {
       this.isIndeterminate = checkedCount > 0 && checkedCount < this.types.length;
     },
     pageChange(currentPage){
-      this.page = currentPage;
+      this.page = currentPage - 1;
       this.fetchData();
     },
     sortChange(){
@@ -132,9 +131,7 @@ export default {
 }
 
 .explore-sorter{
-    /*display: flex;*/
-    /*align-items: center;*/
-    position: absolute;
+    /*position: absolute;*/
     left: 250px;
     top: 5px;
 }

+ 100 - 37
src/views/CommunicationPage/ManagePage.vue

@@ -1,46 +1,83 @@
 <template>
-  <div class="communication-manage">
-    <div class="manage-header">
-      <div class="manage-selector">
-        <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选
-        </el-checkbox>
-        <el-checkbox-group v-model="checkedTypes" @change="handleCheckedTypesChange">
-          <el-checkbox v-for="type in types" :label="type" :key="type">{{ type }}</el-checkbox>
-        </el-checkbox-group>
-      </div>
-      <div class="manage-search">
-        <el-input placeholder="请输入搜索内容" v-model="content"></el-input>
-        <el-button type="primary" style="margin-left: 10px">确认</el-button>
+  <div class="communication-explore">
+    <div class="explore-header">
+      <div class="explore-sorter">
+        <el-select class="sort-select" style="width: 150px;" placeholder="排序方式"
+                   v-model="sort"
+                   @change="sortChange"
+        >
+          <template #prefix>
+                  <span style="padding-left: 5px;">
+                    <i class="el-icon-sort"></i>
+                  </span>
+          </template>
+          <el-option label="发布时间升序" value="PUBLISH_TIME_ASC"></el-option>
+          <el-option label="发布时间降序" value="PUBLISH_TIME_DESC"></el-option>
+          <!--              <el-option label="截止时间升序" value="deadlineAsc"></el-option>-->
+          <!--              <el-option label="截止时间降序" value="deadlineDesc"></el-option>-->
+        </el-select>
       </div>
     </div>
-    <div class="manage-main">
-      <ManageItem class="manage-item"/>
-      <ManageItem class="manage-item"/>
-      <ManageItem class="manage-item"/>
-      <ManageItem class="manage-item"/>
-      <ManageItem class="manage-item"/>
+    <div class="explore-main">
+      <ExploreItem class="explore-item"
+                   v-for="communication in communicationList"
+                   :key="communication.id"
+                   :communicationVO="communication"
+                   @starChange="starChange(communication)"
+      />
+    </div>
+    <div class="pagination">
+      <el-pagination
+          layout="prev, pager, next"
+          :page-size="size"
+          :total="total"
+          @current-change="pageChange"
+      >
+      </el-pagination>
     </div>
   </div>
 </template>
 
 <script>
-import ManageItem from "@/views/CommunicationPage/components/ManageItem";
+import ExploreItem from "@/views/CommunicationPage/components/ExploreItem.vue";
 
 export default {
   name: "ManagePage",
-  components: {ManageItem},
+  components: {ExploreItem},
   data() {
     return {
-      // manage-selector
+      page: 0,
+      size: 5,
+      total: 0,
+      // explore-selector
       checkAll: true,
       checkedTypes: ["难题", "活动", "其他"],
       types: ["难题", "活动", "其他"],
       isIndeterminate: false,
-      // manage-search
+      // explore-search
       content: "",
+      sort: "PUBLISH_TIME_ASC",
+      communicationList: [],
     };
   },
+  computed: {
+    userId() {
+      return Number(this.$store.state.user.id);
+    },
+  },
   methods: {
+    fetchData(){
+      const payload = {
+        userId: this.userId,
+        page: this.page,
+        size: this.size,
+        sort: this.sort
+      };
+      this.$apis.getUserPublishCommunication(payload).then(res=>{
+        this.communicationList = res.data.data.content;
+        this.total = res.data.data.totalElements;
+      });
+    },
     handleCheckAllChange(val) {
       this.checkedTypes = val ? this.types : [];
       this.isIndeterminate = false;
@@ -49,33 +86,59 @@ export default {
       let checkedCount = value.length;
       this.checkAll = checkedCount === this.types.length;
       this.isIndeterminate = checkedCount > 0 && checkedCount < this.types.length;
+    },
+    pageChange(currentPage){
+      this.page = currentPage - 1;
+      this.fetchData();
+    },
+    sortChange(){
+      this.fetchData();
+    },
+    starChange(communication){
+      communication.starred = !communication.starred;
     }
-  }
+  },
+  async mounted() {
+    this.fetchData();
+  },
 };
 </script>
 
 <style scoped>
-.communication-manage {
-    flex: 1;
-    padding: 10px;
+.communication-explore {
+  flex: 1;
+  padding: 10px;
+}
+
+.explore-header{
+  display: flex;
+  justify-content: space-between;
+  margin-bottom: 20px;
+  position: relative;
+}
+
+.explore-sorter{
+  /*position: absolute;*/
+  left: 250px;
+  top: 5px;
 }
 
-.manage-header{
-    display: flex;
-    justify-content: space-between;
-    margin-bottom: 20px;
+.explore-search{
+  display: flex;
+  align-items: center;
 }
 
-.manage-search{
-    display: flex;
-    align-items: center;
+.explore-main{
+  padding: 0 30px;
 }
 
-.manage-main{
-    padding: 0 30px;
+.explore-item{
+  margin-bottom: 10px;
 }
 
-.manage-item{
-    margin-bottom: 10px;
+.pagination{
+  display: flex;
+  align-items: center;
+  justify-content: center;
 }
 </style>

+ 145 - 0
src/views/CommunicationPage/StarPage.vue

@@ -0,0 +1,145 @@
+<template>
+  <div class="communication-explore">
+    <div class="explore-header">
+      <div class="explore-sorter">
+        <el-select class="sort-select" style="width: 150px;" placeholder="排序方式"
+                   v-model="sort"
+                   @change="sortChange"
+        >
+          <template #prefix>
+                  <span style="padding-left: 5px;">
+                    <i class="el-icon-sort"></i>
+                  </span>
+          </template>
+          <el-option label="发布时间升序" value="PUBLISH_TIME_ASC"></el-option>
+          <el-option label="发布时间降序" value="PUBLISH_TIME_DESC"></el-option>
+          <!--              <el-option label="截止时间升序" value="deadlineAsc"></el-option>-->
+          <!--              <el-option label="截止时间降序" value="deadlineDesc"></el-option>-->
+        </el-select>
+      </div>
+
+    </div>
+    <div class="explore-main">
+      <ExploreItem class="explore-item"
+                   v-for="communication in communicationList"
+                   :key="communication.id"
+                   :communicationVO="communication"
+                   @starChange="starChange(communication)"
+      />
+    </div>
+    <div class="pagination">
+      <el-pagination
+          layout="prev, pager, next"
+          :page-size="size"
+          :total="total"
+          @current-change="pageChange"
+      >
+      </el-pagination>
+    </div>
+  </div>
+</template>
+
+<script>
+import ExploreItem from "@/views/CommunicationPage/components/ExploreItem.vue";
+
+export default {
+  name: "StarPage",
+  components: {ExploreItem},
+  data() {
+    return {
+      page: 0,
+      size: 5,
+      total: 0,
+      // explore-selector
+      checkAll: true,
+      checkedTypes: ["难题", "活动", "其他"],
+      types: ["难题", "活动", "其他"],
+      isIndeterminate: false,
+      // explore-search
+      content: "",
+      sort: "PUBLISH_TIME_ASC",
+      communicationList: [],
+    };
+  },
+  computed: {
+    userId() {
+      return Number(this.$store.state.user.id);
+    },
+  },
+  methods: {
+    fetchData(){
+      const payload = {
+        userId: this.userId,
+        page: this.page,
+        size: this.size,
+        sort: this.sort
+      };
+      this.$apis.getStarredCommunication(payload).then(res=>{
+        this.communicationList = res.data.data.content;
+        this.total = res.data.data.totalElements;
+      });
+    },
+    handleCheckAllChange(val) {
+      this.checkedTypes = val ? this.types : [];
+      this.isIndeterminate = false;
+    },
+    handleCheckedTypesChange(value) {
+      let checkedCount = value.length;
+      this.checkAll = checkedCount === this.types.length;
+      this.isIndeterminate = checkedCount > 0 && checkedCount < this.types.length;
+    },
+    pageChange(currentPage){
+      this.page = currentPage - 1;
+      this.fetchData();
+    },
+    sortChange(){
+      this.fetchData();
+    },
+    starChange(communication){
+      communication.starred = !communication.starred;
+    }
+  },
+  async mounted() {
+    this.fetchData();
+  },
+};
+</script>
+
+<style scoped>
+.communication-explore {
+  flex: 1;
+  padding: 10px;
+}
+
+.explore-header{
+  display: flex;
+  justify-content: space-between;
+  margin-bottom: 20px;
+  position: relative;
+}
+
+.explore-sorter{
+  /*position: absolute;*/
+  left: 250px;
+  top: 5px;
+}
+
+.explore-search{
+  display: flex;
+  align-items: center;
+}
+
+.explore-main{
+  padding: 0 30px;
+}
+
+.explore-item{
+  margin-bottom: 10px;
+}
+
+.pagination{
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+</style>

+ 30 - 17
src/views/CommunicationPage/components/ExploreItem.vue

@@ -1,5 +1,5 @@
 <template>
-    <el-card class="explore-item" shadow="never" @click="this.$router.push('/communication/communicationDetail/' + this.communicationVO.id)">
+    <el-card class="explore-item" shadow="never">
 
         <div class="explore-item-star" >
           <el-tooltip placement="top-start" effect="light">
@@ -7,29 +7,28 @@
               <p style="max-width:500px;">{{starersListString}}收藏了本交流</p>
             </template>
             <div>
-              <el-icon v-if="starred===true" style="font-size: 20px" @click="star()"><Star /></el-icon>
-              <el-icon v-if="starred===false" style="font-size: 20px;color: orange" @click="cancelStar()">
+              <el-icon v-if="starred===false" style="font-size: 20px" @click="star()"><Star /></el-icon>
+              <el-icon v-if="starred===true" style="font-size: 20px;color: orange" @click="cancelStar()">
                 <StarFilled />
               </el-icon>
             </div>
           </el-tooltip>
         </div>
 
-        <div class="explore-item-description">
+        <div class="explore-item-description"  @click="this.$router.push('/communication/communicationDetail/' + this.communicationVO.id)">
             <h1 class="description-title">{{ title}}</h1>
             <div style="font-size: 14px;margin-top: 5px">
-                <span style="color: var(--el-color-danger)" v-if="type==='puzzle'">难题</span>
-              <span style="color: var(--el-color-success)" v-if="type==='event'">活动</span>
-              <span style="color: var(--el-color-primary)" v-if="type==='other'">其他</span>
+              <span style="color: var(--el-color-danger)" v-if="type==='PROBLEM'">难题</span>
+              <span style="color: var(--el-color-success)" v-if="type==='NOTICE'">通知</span>
                 <span style="margin-left: 14px">{{ publisherName }}</span>
                 <span style="margin-left: 14px">{{ organization }}</span>
-                <span style="margin-left: 14px">{{ email }}</span>
+                <span style="margin-left: 14px">{{ contact }}</span>
                 <span style="margin-left: 14px">{{ publishTime }}~{{deadline}}</span>
             </div>
             <p class="description-detail">{{ description }}</p>
         </div>
 
-        <img class="explore-item-img" :src="photos">
+        <img class="explore-item-img" :src="photo">
 
     </el-card>
 
@@ -53,13 +52,25 @@ export default {
       return this.communicationVO.title || "无标题";
     },
     publisherName() {
-      return this.communicationVO.publisherName;
+      return this.communicationVO.publisherName || "匿名";
     },
     organization() {
       return this.communicationVO.organization || "无单位院系";
     },
-    email() {
-      return this.communicationVO.email || "无邮箱";
+    contact() {
+      if (this.communicationVO.email != ""){
+        return this.communicationVO.email;
+      }
+      else if (this.communicationVO.qq != ""){
+        return "qq: " + this.communicationVO.qq;
+      }
+      else if (this.communicationVO.wechat != ""){
+        return "微信: " + this.communicationVO.wechat;
+      }
+      else if (this.communicationVO.phone != ""){
+        return "电话: " + this.communicationVO.phone;
+      }
+      else return "暂无联系方式";
     },
     type() {
       return this.communicationVO.type;
@@ -67,14 +78,14 @@ export default {
     description() {
       return this.communicationVO.description || "无简介";
     },
-    photos() {
-      return this.communicationVO.photos === null ? this.$variables.noImgUrl : this.communicationVO.photos;
+    photo() {
+      return this.communicationVO.photos.length === 0 ? this.$variables.noImgUrl : this.communicationVO.photos[0].fileUrl;
     },
     publishTime(){
-      return this.communicationVO.publishTime;
+      return this.communicationVO.publishTime.substring(0,10);
     },
     deadline(){
-      return this.communicationVO.deadline;
+      return this.communicationVO.deadline.substring(0,10);
     },
     starred: {
       get(){
@@ -88,10 +99,12 @@ export default {
   methods: {
     star(){
       this.$emit("starChange",this.communicationVO);
+      this.$apis.starCommunication(this.$store.state.user.id, this.communicationVO.id);
       ElMessage.success("收藏成功");
     },
     cancelStar(){
       this.$emit("starChange",this.communicationVO);
+      this.$apis.cancelStarCommunication(this.$store.state.user.id, this.communicationVO.id);
       ElMessage.success("取消收藏成功");
     },
     fetchData(){
@@ -100,7 +113,7 @@ export default {
           this.starersList = res.data.data;
           this.starersListString = "";
           this.starersList.forEach(starer=>{
-            this.starersListString = this.starersListString + starer.userName + ",";
+            this.starersListString = this.starersListString + starer.username + ",";
           });
           if (this.starersListString === ""){
             this.starersListString = "暂无用户";