feat: 优化响应式布局并添加签到组件
refactor: 重构CSS和LESS文件以支持响应式设计 fix: 修复图片上传和编辑器解析问题 style: 调整搜索框和日历组件的样式 docs: 更新HTML模板中的广告和操作链接
This commit is contained in:
91
js/index.js
91
js/index.js
@@ -1,12 +1,23 @@
|
||||
const { createApp, ref, onMounted, nextTick, onUnmounted, computed, watch, provide } = Vue;
|
||||
import { headTop } from "../component/head-top/head-top.js";
|
||||
import { itemForum } from "../component/item-forum/item-forum.js";
|
||||
import { latestList } from "../component/latest-list/latest-list.js";
|
||||
import { loadBox } from "../component/load-box/load-box.js";
|
||||
|
||||
const { itemForum } = await import(withVer("../component/item-forum/item-forum.js"));
|
||||
const { itemOffer } = await import(withVer("../component/item-offer/item-offer.js"));
|
||||
const { itemSummary } = await import(withVer("../component/item-summary/item-summary.js"));
|
||||
const { itemVote } = await import(withVer("../component/item-vote/item-vote.js"));
|
||||
const { itemMj } = await import(withVer("../component/item-mj/item-mj.js"));
|
||||
const { itemTenement } = await import(withVer("../component/item-tenement/item-tenement.js"));
|
||||
const { headTop } = await import(withVer("../component/head-top/head-top.js"));
|
||||
const { loadBox } = await import(withVer("../component/load-box/load-box.js"));
|
||||
const { itemProject } = await import(withVer("../component/item-project/item-project.js"));
|
||||
const { latestList } = await import(withVer("../component/latest-list/latest-list.js"));
|
||||
|
||||
const appIndex = createApp({
|
||||
setup() {
|
||||
onMounted(() => getUserInfoWin());
|
||||
onMounted(() => {
|
||||
getUserInfoWin();
|
||||
// const preLoader = document.getElementById("pre-loader");
|
||||
// if (preLoader) preLoader.style.display = "none";
|
||||
});
|
||||
|
||||
let isLogin = ref(false);
|
||||
let realname = ref(0); // 是否已经实名
|
||||
@@ -62,6 +73,8 @@ const appIndex = createApp({
|
||||
getTalkingRecommend();
|
||||
getTopicHandpicked();
|
||||
getTopicLatest();
|
||||
|
||||
document.querySelectorAll(".vuehide").forEach((item) => (item.style.display = "none"));
|
||||
});
|
||||
|
||||
let ongoingbj = ref({}); // 话题数据
|
||||
@@ -70,14 +83,21 @@ const appIndex = createApp({
|
||||
ajaxGet("/v2/api/forum/talkingRecommend").then((res) => {
|
||||
if (res.code != 200) return;
|
||||
let data = res["data"] || [];
|
||||
const ongoing = data.ongoing || [];
|
||||
|
||||
ongoing.forEach((item) => {
|
||||
if (Array.isArray(item.commentUser)) item.commentUser = item.commentUser.slice(0, 4);
|
||||
});
|
||||
|
||||
const getTargetItem = (arr) => {
|
||||
const target = arr.find((item) => item.state === 1);
|
||||
return target !== undefined ? target : arr.length > 0 ? arr[0] : null;
|
||||
return target !== undefined ? target : arr.length > 0 ? arr[Math.floor(Math.random() * arr.length)] : null; // 随机返回一个
|
||||
};
|
||||
|
||||
ongoingbj.value = getTargetItem(data.ongoing || []);
|
||||
pastList.value = data.past || [];
|
||||
ongoingbj.value = getTargetItem(ongoing || []) || {};
|
||||
console.log("ongoingbj", ongoingbj.value);
|
||||
const past = data.past || [];
|
||||
pastList.value = past.sort(() => Math.random() - 0.5).slice(0, 5);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -138,11 +158,11 @@ const appIndex = createApp({
|
||||
|
||||
// 处理 offer 列表滚动
|
||||
const offerListScrolling = (data) => {
|
||||
ajax("https://forum.gter.net/api/index/dynamic").then((res) => {
|
||||
ajaxGet("https://api.gter.net/v2/api/forum/getDynamic").then((res) => {
|
||||
if (res.code == 200) {
|
||||
let data = res["data"] || [];
|
||||
|
||||
data.forEach((item) => (item.date = strtimeago(item.date)));
|
||||
data.forEach((item) => (item.date = strtimeago(item.created_at)));
|
||||
|
||||
let targetValue = [];
|
||||
targetValue = [...data, ...data.slice(0, 6)];
|
||||
@@ -168,7 +188,7 @@ const appIndex = createApp({
|
||||
|
||||
if (scrollup) return;
|
||||
scrollup = new ScrollText("offer-box");
|
||||
scrollup.LineHeight = 55;
|
||||
scrollup.LineHeight = 56;
|
||||
scrollup.Amount = 1;
|
||||
scrollup.Delay = 1;
|
||||
scrollup.Start();
|
||||
@@ -185,29 +205,6 @@ const appIndex = createApp({
|
||||
if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) autoOfferListScroll();
|
||||
};
|
||||
|
||||
const popList = [
|
||||
{
|
||||
title: "26FALL",
|
||||
subtitle: "申请群",
|
||||
img: "https://o.x-php.com/Zvt57TuJSUvkyhw-xG7Y2l-c-5kpcnzqqsgFptxhcq_cQnrlJKN1WgxCBq_D-81qNDQyOQ~~",
|
||||
},
|
||||
{
|
||||
title: "申请求助",
|
||||
subtitle: "寄托院校君",
|
||||
img: "https://u.gter.net/assistantwxqrcode.png",
|
||||
},
|
||||
{
|
||||
title: "香港租房",
|
||||
subtitle: "交流群",
|
||||
img: "https://o.x-php.com/Zvt57TuJSUvkyhw-xG7Y2l-c-5kpcnzqqsgFptxhcq_cQnrlJKN1WgxCBq_D-81qNDQyOQ~~",
|
||||
},
|
||||
{
|
||||
title: "香港租房顾问",
|
||||
subtitle: "寄托方同学",
|
||||
img: "https://o.x-php.com/Zvt57TuJSUvkyhw-xG7Y2l-d_JkpcHnqqsgFptxhcq_cQnrlcaF2WQQQBq_D-81qNDQyOQ~~",
|
||||
},
|
||||
];
|
||||
|
||||
let sectionList = ref([]);
|
||||
const getSectionList = () => {
|
||||
ajaxGet("/v2/api/forum/getSectionList").then((res) => {
|
||||
@@ -238,7 +235,7 @@ const appIndex = createApp({
|
||||
const getList = () => {
|
||||
if (loading.value || page.value == 0) return;
|
||||
loading.value = true;
|
||||
ajaxGet(`/v2/api/forum/topicLists?type=thread&page=${page.value || 1}`)
|
||||
ajaxGet(`/v2/api/forum/topicLists?page=${page.value || 1}`)
|
||||
.then((res) => {
|
||||
if (res.code != 200) return;
|
||||
let data = res.data;
|
||||
@@ -259,12 +256,34 @@ const appIndex = createApp({
|
||||
|
||||
let sidebarHeight = ref(0);
|
||||
|
||||
return { sidebarHeight, matterRef, sidebarFixed, sidebarRef, loading, interviewexperience, vote, offer, topicHandpickedList, list, sectionList, popList, custom_2AdvRef, ongoingbj, pastList, offerMouseover, offerMouseout, offerlist, offerListRef };
|
||||
const handleCheckAttest = (e) => {
|
||||
if (!isLogin.value) {
|
||||
goLogin();
|
||||
e.preventDefault(); // 阻止默认跳转(即使 href 为链接,也强制拦截)
|
||||
return;
|
||||
}
|
||||
if (realname.value === 0 && userInfoWin.value?.uin > 0) {
|
||||
openAttest();
|
||||
e.preventDefault(); // 阻止默认跳转(即使 href 为链接,也强制拦截)
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
SignInComponent.initComponent()
|
||||
})
|
||||
|
||||
return { handleCheckAttest, sidebarHeight, matterRef, sidebarFixed, sidebarRef, loading, interviewexperience, vote, offer, topicHandpickedList, list, sectionList, custom_2AdvRef, ongoingbj, pastList, offerMouseover, offerMouseout, offerlist, offerListRef };
|
||||
},
|
||||
});
|
||||
|
||||
appIndex.component("headTop", headTop);
|
||||
appIndex.component("itemForum", itemForum);
|
||||
appIndex.component("itemOffer", itemOffer);
|
||||
appIndex.component("itemSummary", itemSummary);
|
||||
appIndex.component("itemVote", itemVote);
|
||||
appIndex.component("itemMj", itemMj);
|
||||
appIndex.component("itemTenement", itemTenement);
|
||||
appIndex.component("itemProject", itemProject);
|
||||
appIndex.component("latestList", latestList);
|
||||
appIndex.component("load-box", loadBox);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user