Skip to content

Commit

Permalink
fix: relike post show
Browse files Browse the repository at this point in the history
  • Loading branch information
Loo authored and Loo committed Oct 30, 2023
1 parent 2235f80 commit 8ce264d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
5 changes: 5 additions & 0 deletions app/scripts/utils/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ const convertBlogList = async ({
text_raw,
retweeted_status,
page_info,
reposts_count,
mix_media_info,
title,
} = blogItem || {}

if (!_.isEmpty(page_info?.media_info)) {
Expand Down Expand Up @@ -260,6 +262,7 @@ const convertBlogList = async ({
screen_name: retweeted_status.user?.screen_name,
}
retweetedBlog = {
reposts_count: retweeted_status.reposts_count,
user: retweetFromUser,
created_at: retweeted_status.created_at,
attitudes_count: retweeted_status.attitudes_count,
Expand Down Expand Up @@ -325,6 +328,7 @@ const convertBlogList = async ({
}

finalList.push({
reposts_count, // 转发数
created_at, // 创建时间
attitudes_count, // 点赞数
attitudes_status,
Expand All @@ -342,6 +346,7 @@ const convertBlogList = async ({
text_raw,
retweetedBlog,
mediaInfoList,
title: title?.text ? { text: title.text } : undefined,
})
}

Expand Down
3 changes: 2 additions & 1 deletion weiboSave/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
<body class=" " id="weibo-extend-weibosave">
<div class="bg-gray-100">
<div id="weibo-extend-posts" class=" mx-auto my-0 w-[50rem] px-8 flex flex-col gap-6 break-words pb-10">
<div class=" border-b border-dashed border-gray-100 overflow-scroll text-xs text-gray-500 rounded "></div>
</div>
<div id="imagePopup" class="hidden fixed p-4 inset-0 items-center justify-center bg-black bg-opacity-50">
<img src="" alt="Popup Image" class="max-w-full max-h-full rounded-xl">
</div>
</div>

<div class=" border-b border-dashed border-gray-100 overflow-scroll text-xs text-gray-500 rounded text-base"></div>
</body>
</html>
13 changes: 11 additions & 2 deletions weiboSave/scripts/weibosave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const imageClass = `cursor-pointer w-full h-full object-cover rounded-xl`
const retweetPostClass = `flex reweetpost bg-gray-100 pt-5 pb-8 px-8 flex my-2 rounded-md flex-col`
const videoContainerClass = `video flex flex-col items-center flex-wrap gap-2 mb-2`
const videoClass = `cursor-pointer object-cover rounded-xl max-h-[38rem] w-fit`
const titleClass = `flex flex-col text-gray-500 text-sm italic`

const start=async ()=>{
console.log(`start`, start)
Expand All @@ -40,12 +41,20 @@ const start=async ()=>{
start()

const appendBlog = ({$container, blogItem, postClass}: Record<string, any>)=>{
const { text, text_raw, picShows, region_name, source, created_at, user, mediaInfoList } = blogItem || {}
const { text, text_raw, picShows, region_name, source, created_at, user, mediaInfoList, title } = blogItem || {}

let $postInside = $('<div>').addClass(postInsideClass);

const titleText = title?.text || '';
if(titleText){
const $titleDiv = $("<div>").text(titleText).addClass(titleClass);
$postInside.append($titleDiv)
}

const {idstr: user_idstr, screen_name: user_screen_name, profile_url: user_profile_url } = user || {}
if(user_idstr && user_screen_name){
const userInfoText = `@${user_screen_name}`
let $userInfoDiv = $("<div>").addClass(`flex text-md font-bold text-gray-700 hover:text-orange-500 cursor-pointer`).append($("<span>").html(userInfoText))
let $userInfoDiv = $("<div>").addClass(`flex text-base font-bold text-gray-700 hover:text-orange-500 cursor-pointer`).append($("<span>").html(userInfoText))
$userInfoDiv.click(function(){
const jumpUrl = user_profile_url ? `https://weibo.com${user_profile_url}` : (user_idstr ? `https://weibo.com/u/${user_idstr}` : '')
if(jumpUrl){
Expand Down

0 comments on commit 8ce264d

Please sign in to comment.