diff --git a/component/item-bottom/item-bottom.js b/component/item-bottom/item-bottom.js
index 925a4be..27dc297 100644
--- a/component/item-bottom/item-bottom.js
+++ b/component/item-bottom/item-bottom.js
@@ -78,7 +78,7 @@ export const itemBottom = defineComponent({
const token = item.value.token || "";
- ajax(`https://api.gter.net/v2/api/forum/postTopicCollect`, {
+ ajax(`/v2/api/forum/postTopicCollect`, {
token,
})
.then((res) => {
diff --git a/component/item-forum/item-forum.js b/component/item-forum/item-forum.js
index 1f6425e..d1a9be1 100644
--- a/component/item-forum/item-forum.js
+++ b/component/item-forum/item-forum.js
@@ -12,6 +12,10 @@ export const itemForum = defineComponent({
type: Object,
default: () => {},
},
+ page: {
+ type: String,
+ default: "",
+ },
},
setup(props) {
@@ -29,5 +33,5 @@ export const itemForum = defineComponent({
itemHead,
},
- template: `
`,
+ template: `
`,
});
diff --git a/component/item-forum/item-forum.txt b/component/item-forum/item-forum.txt
index 62d6b7c..194f85c 100644
--- a/component/item-forum/item-forum.txt
+++ b/component/item-forum/item-forum.txt
@@ -1,8 +1,8 @@
\ No newline at end of file
diff --git a/component/item-head/item-head.js b/component/item-head/item-head.js
index feb4675..45836bc 100644
--- a/component/item-head/item-head.js
+++ b/component/item-head/item-head.js
@@ -1,6 +1,6 @@
// my-component.js
// 引入全局 Vue 对象(因在 HTML 中通过 script 引入,Vue 已挂载到 window)
-const { defineComponent, ref, provide, onMounted } = Vue;
+const { defineComponent, ref, provide, onMounted, inject } = Vue;
import { report } from "../report/report.js";
// 定义组件(直接使用模板)
@@ -11,6 +11,11 @@ export const itemHead = defineComponent({
type: Object,
default: () => {},
},
+
+ page: {
+ type: String,
+ default: "",
+ },
},
setup(props) {
@@ -89,20 +94,24 @@ export const itemHead = defineComponent({
});
};
- // let cancelOperate = inject("cancelOperate");
-
+ // let handleDelete = inject("handleDelete");
+ let itemHead = ref(null);
// 删除
const deleteItem = () => {
const target = item.value;
- console.log("deleteItem");
+ console.log("deleteItem", target, target.token);
+ managerDelete(target.token)
+ .then(() => {
+ const targetNode = itemHead.value;
+ if (!targetNode) return;
- // managerDelete(target.token)
- // .then(() => {
- // cancelOperate("like", token);
- // })
- // .finally(() => {
- // cutShow();
- // });
+ const parentItemBox = targetNode.parentElement;
+ if (parentItemBox?.classList.contains("item-box")) parentItemBox.style.display = "none";
+
+ })
+ .finally(() => {
+ cutShow();
+ });
};
// 编辑
@@ -116,12 +125,44 @@ export const itemHead = defineComponent({
redirectToExternalWebsite(`/space?uin=${uin}&uid=${uid}`);
};
- return { edit, deleteItem, goPersonalHomepage, reportState, cutShow, show, item, timestamp, sectionn, tags, ismanager, report, hide, recommend, essence };
+ const openedit = (type) => {
+ let url = ``;
+ if (type == "offer") url = `https://offer.gter.net/post/modify?id=${item.value.token}`;
+ else if (type == "offer_summary") url = `https://offer.gter.net/post/summary`;
+ redirectToExternalWebsite(url);
+ };
+
+ const anonymousState = ref(false);
+ const cutAnonymous = () => {
+ anonymousState.value = !anonymousState.value;
+ };
+
+ const cutAnonymousState = (state) => {
+ console.log("state", state);
+ const target = item.value;
+ ajax("/v2/api/forum/postTopicAnonymousStatus", {
+ token: target.token,
+ anonymous: state,
+ })
+ .then((res) => {
+ console.log("res", res);
+ if (res.code != 200) return;
+ const data = res.data || {};
+ target.anonymous = data.anonymous || 0;
+ item.value = target;
+ creationAlertBox("success", res.message || "操作成功");
+ })
+ .finally(() => {
+ cutAnonymous();
+ });
+ };
+
+ return { itemHead, cutAnonymousState, cutAnonymous, anonymousState, openedit, edit, deleteItem, goPersonalHomepage, reportState, cutShow, show, item, timestamp, sectionn, tags, ismanager, report, hide, recommend, essence };
},
components: {
report,
},
- template: `
{{ item?.user?.nickname || item.nickname || "匿名用户" }}
{{ timestamp }}
{{ item.views }}
举报
{{ item.hidden == 0 ? "隐藏" : "显示" }}
{{ item.recommend == 1 ? "取消" : "" }}推荐
{{ item.best == 1 ? "取消" : "" }}精华
编辑
删除
`,
+ template: `
{{ item?.user?.nickname || item.nickname || "匿名用户" }}
{{ timestamp }}
公开 匿名
公开发表
匿名发表
{{ item.views }}
举报
{{ item.hidden == 0 ? "隐藏" : "显示" }}
{{ item.recommend == 1 ? "取消" : "" }}推荐
{{ item.best == 1 ? "取消" : "" }}精华
编辑
删除
删除
`,
});
diff --git a/component/item-head/item-head.txt b/component/item-head/item-head.txt
index 82b5e31..5275f19 100644
--- a/component/item-head/item-head.txt
+++ b/component/item-head/item-head.txt
@@ -1,4 +1,4 @@
-
+
{{ item?.user?.nickname || item.nickname || "匿名用户" }}
@@ -8,6 +8,31 @@
{{ timestamp }}
+
+

+
+
+
+
+ 公开
+ 匿名
+
+
+
+
+
+
+
公开发表
+

+
+
匿名发表
+

+
+
+
+
+
+
{{ item.views }}
@@ -31,6 +56,7 @@
编辑
删除
+
删除
diff --git a/component/item-mj/item-mj.js b/component/item-mj/item-mj.js
index ddea129..4545afe 100644
--- a/component/item-mj/item-mj.js
+++ b/component/item-mj/item-mj.js
@@ -12,6 +12,10 @@ export const itemMj = defineComponent({
type: Object,
default: () => {},
},
+ page: {
+ type: String,
+ default: "",
+ },
},
setup(props) {
@@ -25,5 +29,5 @@ export const itemMj = defineComponent({
itemHead,
},
- template: `
`,
+ template: `
`,
});
diff --git a/component/item-mj/item-mj.txt b/component/item-mj/item-mj.txt
index 16ce65c..02116c3 100644
--- a/component/item-mj/item-mj.txt
+++ b/component/item-mj/item-mj.txt
@@ -1,5 +1,5 @@
\ No newline at end of file
diff --git a/component/item-offer/item-offer.js b/component/item-offer/item-offer.js
index 79cb7d8..83564ee 100644
--- a/component/item-offer/item-offer.js
+++ b/component/item-offer/item-offer.js
@@ -12,64 +12,16 @@ export const itemOffer = defineComponent({
type: Object,
default: () => {},
},
+ page: {
+ type: String,
+ default: "",
+ },
},
setup(props) {
let item = ref({ ...props.itemdata });
item.value["url"] = "/details/" + item.value.uniqid;
- // let isLogin = ref(true);
- // let realname = ref(1); // 是否已经实名
- // let userInfoWin = ref({
- // authority: ["comment.edit", "comment.delete", "offercollege.hide", "offersummary.hide", "mj.hide", "topic:manager", "topic:hide"],
- // avatar: "https://nas.gter.net:9008/avatar/97K4EWIMLrsbGTWXslC2WFVSEKWOikN42jDKLNjtax7HL4xtfMOJSdU9oWFhY2E~/middle?random=1761733169",
- // groupid: 3,
- // nickname: "肖荣豪",
- // realname: 1,
- // token: "01346a38444d71aaadb3adad52b52c39",
- // uid: 500144,
- // uin: 4238049,
- // });
-
- // let permissions = ref([]);
-
- // const getUserInfoWin = () => {
- // const checkUser = () => {
- // const user = window.userInfoWin;
- // if (!user) return;
- // document.removeEventListener("getUser", checkUser);
- // realname.value = user.realname;
- // userInfoWin.value = user;
- // if (user?.uin > 0 || user?.uid > 0) isLogin.value = true;
- // };
- // document.addEventListener("getUser", checkUser);
- // };
-
- // const openAttest = () => {
- // const handleAttestClose = () => {
- // document.removeEventListener("closeAttest", handleAttestClose);
- // realname.value = window.userInfoWin?.realname || 0;
- // };
- // // 启动认证流程时添加监听
- // document.addEventListener("closeAttest", handleAttestClose);
- // loadAttest(2);
- // };
-
- // // 跳转登录
- // const goLogin = () => {
- // if (typeof window === "undefined") return;
- // if (window["userInfoWin"] && Object.keys(window["userInfoWin"]).length !== 0) {
- // if (window["userInfoWin"]["uid"]) isLogin.value = true;
- // else ajax_login();
- // } else ajax_login();
- // };
-
- // provide("isLogin", isLogin);
- // provide("userInfoWin", userInfoWin);
- // provide("realname", realname);
- // provide("openAttest", openAttest);
- // provide("goLogin", goLogin);
-
return { item };
},
@@ -78,5 +30,5 @@ export const itemOffer = defineComponent({
itemHead,
},
- template: `
`,
+ template: `
`,
});
diff --git a/component/item-offer/item-offer.txt b/component/item-offer/item-offer.txt
index 46064d8..5ec8ffa 100644
--- a/component/item-offer/item-offer.txt
+++ b/component/item-offer/item-offer.txt
@@ -1,5 +1,5 @@
\ No newline at end of file
diff --git a/component/item-summary/item-summary.js b/component/item-summary/item-summary.js
index 5e63e34..f788bd8 100644
--- a/component/item-summary/item-summary.js
+++ b/component/item-summary/item-summary.js
@@ -12,6 +12,10 @@ export const itemSummary = defineComponent({
type: Object,
default: () => {},
},
+ page: {
+ type: String,
+ default: "",
+ },
},
setup(props) {
@@ -26,5 +30,5 @@ export const itemSummary = defineComponent({
itemHead,
},
- template: `
`,
+ template: `
`,
});
diff --git a/component/item-summary/item-summary.txt b/component/item-summary/item-summary.txt
index c4f84d3..5a40b02 100644
--- a/component/item-summary/item-summary.txt
+++ b/component/item-summary/item-summary.txt
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/component/item-tenement/item-tenement.js b/component/item-tenement/item-tenement.js
index 3a27555..041e206 100644
--- a/component/item-tenement/item-tenement.js
+++ b/component/item-tenement/item-tenement.js
@@ -12,6 +12,10 @@ export const itemTenement = defineComponent({
type: Object,
default: () => {},
},
+ page: {
+ type: String,
+ default: "",
+ },
},
setup(props) {
@@ -84,5 +88,5 @@ export const itemTenement = defineComponent({
itemHead,
},
- template: `
`,
});
diff --git a/component/item-tenement/item-tenement.txt b/component/item-tenement/item-tenement.txt
index c91840f..bd93808 100644
--- a/component/item-tenement/item-tenement.txt
+++ b/component/item-tenement/item-tenement.txt
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/component/item-vote/item-vote.js b/component/item-vote/item-vote.js
index 0b67c39..ced9927 100644
--- a/component/item-vote/item-vote.js
+++ b/component/item-vote/item-vote.js
@@ -12,11 +12,62 @@ export const itemVote = defineComponent({
type: Object,
default: () => {},
},
+ page: {
+ type: String,
+ default: "",
+ },
},
setup(props) {
+ // 处理 截止时间
+ const handleDeadline = (dateTimeStamp = "") => {
+ if (typeof dateTimeStamp == "number") dateTimeStamp = dateTimeStamp ? dateTimeStamp * 1000 : null;
+ if (typeof dateTimeStamp == "string" && dateTimeStamp.match(/^\d{4}-\d{2}-\d{2}$/)) dateTimeStamp += " 23:59:59";
+ const timestamp = new Date(dateTimeStamp.replace(/-/g, "/")).getTime();
+ const now = Date.now();
+ const diffValue = timestamp - now;
+
+ if (diffValue < 0) return null;
+
+ const units = [
+ {
+ value: 24 * 60 * 60 * 1000,
+ unit: "天",
+ },
+ {
+ value: 60 * 60 * 1000,
+ unit: "小时",
+ },
+ {
+ value: 60 * 1000,
+ unit: "分钟",
+ },
+ {
+ value: 1000,
+ unit: "秒",
+ },
+ ];
+
+ for (const { value, unit } of units) {
+ if (diffValue >= value) {
+ return {
+ num: Math.round(diffValue / value),
+ unit,
+ };
+ }
+ }
+ return {
+ num: 0,
+ unit: "秒",
+ };
+ };
+
let item = ref({ ...props.itemdata });
- item.value['url'] = 'https://vote.gter.net/details/' + item.value.uniqid;
+ item.value["time"] = handleDeadline(item.value.data.deadline);
+ item.value["url"] = "/details/" + item.value.uniqid;
+ const option = item.value.data.option || [];
+ item.value["isvote"] = option.some((item) => item.selected == 1);
+
return { item };
},
@@ -25,5 +76,5 @@ export const itemVote = defineComponent({
itemHead,
},
- template: `
`,
+ template: `
`,
});
diff --git a/component/item-vote/item-vote.txt b/component/item-vote/item-vote.txt
index 45bb721..929b9d2 100644
--- a/component/item-vote/item-vote.txt
+++ b/component/item-vote/item-vote.txt
@@ -1,5 +1,5 @@