Переглянути джерело

展开收缩 工作经历

lifanagju_citu 1 день тому
батько
коміт
ddfd8b8b25

+ 1 - 1
pages/index/components/condition.vue

@@ -75,7 +75,7 @@ const getTalentList = async () => {
           exp.endTimeStr = exp.startTime ? exp.endTime ? timesTampChange(exp.endTime, 'Y-M') : '至今' : ''
           exp.year = exp.endTimeStr ? getTimeDifferenceInChinese(exp.startTime, exp.endTime) : ''
         })
-				e.workList = e.workList.splice(0, 2)
+				// e.workList = e.workList.splice(0, 2)
       }
       return e
     })

+ 18 - 12
pages/index/components/talentItem.vue

@@ -45,19 +45,22 @@
 
 			<!-- 工作经历 -->
 			<view v-if="val?.workList && val.workList.length > 0 && !showLastWorkExp" class="ss-m-t-15 color-666 font-size-14">
-				<view v-for="k in val.workList" :key="k.id" class="ss-m-b-30">
-					<view>
-						<uni-icons type="smallcircle" class="ss-m-r-10" color="#666"></uni-icons>
-						{{ formatName(k.enterpriseName) || '未填写企业名称' }}
-					</view>
-					<view class="ss-m-l-45">
-						<span>{{ formatName(k.positionName) || '未填写职位名称' }}</span>
-						<span class="ss-m-l-20">
-							<span>{{ k.startTimeStr }}</span>
-							<span v-if="k.endTimeStr"> - {{ k.endTimeStr }}</span>
-						</span>
-					</view>
+				<view v-for="(k, index) in val.workList" :key="k.id" class="ss-m-b-30">
+					<template v-if="val.showAll || index < 2">
+						<view>
+							<uni-icons type="smallcircle" class="ss-m-r-10" color="#666"></uni-icons>
+							{{ formatName(k.enterpriseName) || '未填写企业名称' }}
+						</view>
+						<view class="ss-m-l-45">
+							<span>{{ formatName(k.positionName) || '未填写职位名称' }}</span>
+							<span class="ss-m-l-20">
+								<span>{{ k.startTimeStr }}</span>
+								<span v-if="k.endTimeStr"> - {{ k.endTimeStr }}</span>
+							</span>
+						</view>
+					</template>
 				</view>
+				<view v-if="val.workList.length > 2" class="showBtn color-primary" @tap.stop="val.showAll = Boolean(!val.showAll)">{{ val.showAll ? '收起' : '展开全部' }}</view>
 			</view>
 		</view>
 	</view>
@@ -119,4 +122,7 @@ const handleDetail = ({ userId }) => {
 		border-radius: 50%;
 	}
 }
+.showBtn {
+	text-align: center;
+}
 </style>