feat: 新增详情页和个人主页功能及组件优化

- 添加详情页(details.html)和个人主页(homepage-me.html)的完整功能实现
- 新增多个图片资源用于UI展示
- 优化item-head、item-bottom等组件的数据绑定和交互逻辑
- 添加公共工具函数(public.js)包括时间处理和网络请求
- 完善CSS样式文件,增加响应式布局和交互效果
- 实现用户信息展示、帖子详情、相关帖子推荐等功能模块
- 添加签到、投币等交互功能
- 优化组件模板结构和数据传递方式
This commit is contained in:
DESKTOP-RQ919RC\Pc
2025-10-28 19:10:26 +08:00
parent 89703bf025
commit 7d81e02d3d
48 changed files with 4809 additions and 689 deletions

75
js/details.js Normal file
View File

@@ -0,0 +1,75 @@
const { createApp, ref, onMounted, nextTick, onUnmounted, computed, watch } = Vue;
import { itemForum } from "../component/item-forum/item-forum.js";
import { itemOffer } from "../component/item-offer/item-offer.js";
import { itemSummary } from "../component/item-summary/item-summary.js";
import { itemVote } from "../component/item-vote/item-vote.js";
import { itemMj } from "../component/item-mj/item-mj.js";
import { itemTenement } from "../component/item-tenement/item-tenement.js";
const appSectionIndex = createApp({
setup() {
let signInAlreadyState = ref(false);
let authorInfo = ref({});
let info = ref({});
let ismyself = ref(false);
let labelList = ref({
sectionn: "",
tags: [],
});
let timestamp = ref("");
let updatedTime = ref("");
let token = "";
onMounted(() => {
init();
});
const init = () => {
ajaxget(`https://api.gter.net/v2/api/forum/getTopicDetails?uniqid=${"9GPSfyaGDTz5"}`).then((res) => {
console.log("res", res);
const data = res.data;
console.log("data", data);
let targetInfo = data.info;
if (!targetInfo.hidden) targetInfo.hidden = 0;
// 替换换行
targetInfo.content = targetInfo.content?.replace(/\n/g, "<br>") || "";
if (!targetInfo.content) {
targetInfo.content = targetInfo.title;
targetInfo.title = "";
}
authorInfo.value = Array.isArray(data.authorInfo) ? null : data.authorInfo;
ismyself.value = data.ismyself || false;
labelList.value = {
sectionn: targetInfo.sectionn,
tags: targetInfo.tags,
};
timestamp.value = strtimeago(targetInfo.release_at, 4);
updatedTime.value = targetInfo.updated_at ? strtimeago(targetInfo.updated_at, 4) : null;
info.value = targetInfo;
token = data.token;
// if (this.islogin) this.getTopicOperation();
});
};
return { signInAlreadyState, authorInfo, info, timestamp, updatedTime, labelList };
},
});
appSectionIndex.component("itemForum", itemForum);
appSectionIndex.component("itemOffer", itemOffer);
appSectionIndex.component("itemSummary", itemSummary);
appSectionIndex.component("itemVote", itemVote);
appSectionIndex.component("itemMj", itemMj);
appSectionIndex.component("itemTenement", itemTenement);
appSectionIndex.mount("#details");