mirror of
				https://github.com/continew-org/continew-admin-ui.git
				synced 2025-10-31 22:57:15 +08:00 
			
		
		
		
	chore: 优化工作台最新动态
This commit is contained in:
		| @@ -1,25 +1,49 @@ | ||||
| <template> | ||||
|   <a-card class="general-card" title="最新动态" style="margin-bottom: 14px"> | ||||
|     <template #extra> | ||||
|       <a-link href="https://gitee.com/organizations/continew/events" target="_blank" rel="noopener">更多</a-link> | ||||
|       <a-dropdown> | ||||
|         <a-link>更多</a-link> | ||||
|         <template #content> | ||||
|           <a-doption> | ||||
|             <a-link href="https://gitee.com/organizations/continew/events" target="_blank" rel="noopener">Gitee</a-link> | ||||
|           </a-doption> | ||||
|           <a-doption> | ||||
|             <a-link href="https://gitcode.com/org/continew/discussion" target="_blank" rel="noopener">GitCode</a-link> | ||||
|           </a-doption> | ||||
|           <a-doption> | ||||
|             <a-link href="https://github.com/orgs/continew-org/discussions" target="_blank" rel="noopener">GitHub</a-link> | ||||
|           </a-doption> | ||||
|         </template> | ||||
|       </a-dropdown> | ||||
|     </template> | ||||
|     <a-skeleton v-if="loading" :loading="loading" :animation="true"> | ||||
|       <a-skeleton-line :rows="10" /> | ||||
|     </a-skeleton> | ||||
|     <div v-else> | ||||
|       <a-empty v-if="dataList.length === 0">暂无动态</a-empty> | ||||
|       <a-comment | ||||
|         v-for="(item, index) in dataList" | ||||
|         v-else | ||||
|         :key="index" | ||||
|         :author="item.actor.nickname" | ||||
|       align="right" | ||||
|         :class="`animated-fade-up-${index}`" | ||||
|       > | ||||
|         <template #avatar> | ||||
|           <a-badge> | ||||
|             <template #content> | ||||
|               <GiSvgIcon v-if="item.platform === 'GitHub'" name="github" :size="15" /> | ||||
|               <GiSvgIcon v-else-if="item.platform === 'Gitee'" name="gitee" :size="15" /> | ||||
|             </template> | ||||
|             <a :href="item.actor.url" target="_blank" rel="noopener"> | ||||
|               <a-avatar :size="30"> | ||||
|                 <img :src="item.actor.avatar" alt="avatar" /> | ||||
|               </a-avatar> | ||||
|             </a> | ||||
|           </a-badge> | ||||
|         </template> | ||||
|         <template #datetime> | ||||
|           <span :title="item.createTime">{{ item.createTimeString }}</span> | ||||
|         </template> | ||||
|       <template #datetime><span :title="item.createTime">{{ item.createTimeString }}</span></template> | ||||
|         <template #content> | ||||
|           <div class="content"> | ||||
|             <p v-if="item.type === 'PUSH'"> | ||||
| @@ -31,28 +55,37 @@ | ||||
|                 class="commit" | ||||
|               > | ||||
|                 <template #content> | ||||
|                 <a-link :href="`${item.repo.url}${commit.url}`" target="_blank" rel="noopener" style="font-size: 12px">{{ commit.sha.substring(0, 7) }}</a-link> | ||||
|                 <a :href="`${item.repo.url}${commit.url}`" target="_blank" rel="noopener">{{ commit.message }}</a> | ||||
|                   <a-link :href="commit.url" target="_blank" rel="noopener" style="font-size: 12px" :title="commit.message">{{ commit.sha.substring(0, 7) }}</a-link> | ||||
|                   <a :href="commit.url" target="_blank" rel="noopener" :title="commit.message">{{ commit.message }}</a> | ||||
|                 </template> | ||||
|               </a-comment> | ||||
|             </p> | ||||
|             <p v-else-if="item.type === 'ISSUE_OPEN'"> | ||||
|               在 <a-link :href="item.repo.url" target="_blank" rel="noopener">{{ item.repo.alias }}</a-link> | ||||
|             创建了任务 <a-link :href="item.payload.url" target="_blank" rel="noopener">{{ item.payload.title }}</a-link> | ||||
|               创建了 Issue <a-link :href="item.payload.url" target="_blank" rel="noopener">{{ item.payload.title }}</a-link> | ||||
|             </p> | ||||
|             <p v-else-if="item.type === 'ISSUE_CLOSE'"> | ||||
|               更改了 <a-link :href="item.repo.url" target="_blank" rel="noopener">{{ item.repo.alias }}</a-link> | ||||
|             的任务 <a-link :href="item.payload.url" target="_blank" rel="noopener">{{ item.payload.title }}</a-link> | ||||
|             状态为 {{ item.payload.action === 'rejected' ? '已关闭' : '已完成' }} | ||||
|               的 Issue <a-link :href="item.payload.url" target="_blank" rel="noopener">{{ item.payload.title }}</a-link> | ||||
|               状态为 {{ item.payload.stateString }} | ||||
|             </p> | ||||
|             <p v-else-if="item.type === 'ISSUE_COMMENT'"> | ||||
|               评论了 <a-link :href="item.repo.url" target="_blank" rel="noopener">{{ item.repo.alias }}</a-link> | ||||
|             的任务 <a-link :href="item.payload.url" target="_blank" rel="noopener">{{ item.payload.title }}</a-link> | ||||
|               的 Issue <a-link :href="item.payload.url" target="_blank" rel="noopener">{{ item.payload.title }}</a-link> | ||||
|             </p> | ||||
|           <p v-else-if="item.type === 'PULL_REQUEST'"> | ||||
|             <p v-else-if="item.type === 'PULL_REQUEST_OPEN'"> | ||||
|               在 <a-link :href="item.repo.url" target="_blank" rel="noopener">{{ item.repo.alias }}</a-link> | ||||
|               创建了 Pull Request <a-link :href="item.payload.url" target="_blank" rel="noopener">{{ item.payload.title }}</a-link> | ||||
|             </p> | ||||
|             <p v-else-if="item.type === 'PULL_REQUEST_MERGE'"> | ||||
|               接受了 <a-link :href="item.repo.url" target="_blank" rel="noopener">{{ item.repo.alias }}</a-link> | ||||
|               的 Pull Request <a-link :href="item.payload.url" target="_blank" rel="noopener">{{ item.payload.title }}</a-link> | ||||
|             </p> | ||||
|             <p v-else-if="item.type === 'PULL_REQUEST_CLOSE'"> | ||||
|               更改了 <a-link :href="item.repo.url" target="_blank" rel="noopener">{{ item.repo.alias }}</a-link> | ||||
|               的 Pull Request <a-link :href="item.payload.url" target="_blank" rel="noopener">{{ item.payload.title }}</a-link> | ||||
|               状态为 {{ item.payload.stateString }} | ||||
|             </p> | ||||
|             <p v-else-if="item.type === 'CREATE'"> | ||||
|               推送了新的 {{ item.payload.refType }} | ||||
|               <a-link :href="item.payload.url" target="_blank" rel="noopener">{{ item.payload.ref }}</a-link> | ||||
| @@ -66,6 +99,7 @@ | ||||
|           </div> | ||||
|         </template> | ||||
|       </a-comment> | ||||
|     </div> | ||||
|   </a-card> | ||||
| </template> | ||||
|  | ||||
| @@ -118,7 +152,7 @@ const loading = ref(false) | ||||
| const getDataList = async () => { | ||||
|   try { | ||||
|     loading.value = true | ||||
|     const { data } = await get('https://api.charles7c.top/git/orgs/continew/events?limit=10') | ||||
|     const { data } = await get('https://api.charles7c.top/git/orgs/continew/events') | ||||
|     data.forEach((item) => { | ||||
|       dataList.value.push({ | ||||
|         ...item, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user