From 3f8a41f3ae9b85fdf6f9b43441f1057f9c7e90cf Mon Sep 17 00:00:00 2001 From: Kaviilee Date: Sun, 26 Jan 2025 23:30:00 +0800 Subject: [PATCH] chore: update pkg --- src/components/single/single.vue | 32 +++++---- src/components/single/single_dat.vue | 101 ++++++++++++++++++++------- 2 files changed, 94 insertions(+), 39 deletions(-) diff --git a/src/components/single/single.vue b/src/components/single/single.vue index 288a9ac..cdadaf3 100644 --- a/src/components/single/single.vue +++ b/src/components/single/single.vue @@ -26,7 +26,7 @@ import { getAppIcon, getAppID } from "@jx3box/jx3box-common/js/utils"; import User from "@jx3box/jx3box-common/js/user"; export default { name: "single", - data: function() { + data: function () { return { loading: false, post: {}, @@ -35,25 +35,24 @@ export default { }; }, computed: { - post_subtype: function() { + post_subtype: function () { let subtype = this.post?.post_subtype; return subtype ? types[subtype] : "-"; }, - isTool: function() { + isTool: function () { return this.post?.post_subtype == "1"; }, }, - methods : { - updateExtend : function (val){ - this.$store.state.extend = val - } + methods: { + updateExtend: function (val) { + this.$store.state.extend = val; + }, }, - mounted: function() { + mounted: function () { if (this.id) { this.loading = true; getPost(this.id) .then((res) => { - this.post = this.$store.state.post = res.data.data; this.$store.state.id = this.id; this.$store.state.user_id = this.post?.post_author; @@ -66,10 +65,19 @@ export default { source_id: ~~this.id, link: location.href, title: this.post.post_title, + author_id: this.post.post_author, + banner: this.post.post_banner, }); - this.post.visible > 1 && postReadHistory({ id: this.id, category: "posts", subcategory: "default", visible_type: this.post.visible }); + this.post.visible > 1 && + postReadHistory({ + id: this.id, + category: "posts", + subcategory: "default", + visible_type: this.post.visible, + author_id: this.post.post_author, + banner: this.post.post_banner, + }); } - }) .finally(() => { this.loading = false; @@ -83,7 +91,7 @@ export default { }, components: { singlebox, - 'single-meta':single_meta, + "single-meta": single_meta, }, }; diff --git a/src/components/single/single_dat.vue b/src/components/single/single_dat.vue index e407353..4c51ff4 100644 --- a/src/components/single/single_dat.vue +++ b/src/components/single/single_dat.vue @@ -23,7 +23,11 @@ 云端同步刷新 {{ feed.desc }} - + 本地下载 @@ -41,14 +45,20 @@ 云端同步刷新 {{ feed.desc }} - + 本地下载 @@ -66,14 +76,20 @@ 云端同步刷新 {{ feed.desc }} - + 本地下载 @@ -81,17 +97,35 @@
- +
- +
- +
@@ -99,7 +133,12 @@
数据类型:{{ post_subtype }} - + 默认数据下载 下载 @@ -118,38 +157,37 @@ import { getPost } from "../../service/post.js"; import { getStat, postStat, postHistory, postReadHistory } from "@jx3box/jx3box-common/js/stat"; import { jx3dat_types } from "../../assets/data/types.json"; import { appKey } from "../../../setting.json"; -import { getAppIcon, getAppID,resolveImagePath, getLink } from "@jx3box/jx3box-common/js/utils"; - +import { getAppIcon, getAppID, resolveImagePath, getLink } from "@jx3box/jx3box-common/js/utils"; // 工具方法 import User from "@jx3box/jx3box-common/js/user"; export default { name: "single", - data: function() { + data: function () { return { loading: false, post: {}, stat: {}, meta: {}, - data : [], + data: [], appKey, id: getAppID(), }; }, computed: { - isAuthor: function() { + isAuthor: function () { return User.getInfo().uid == this.post?.post_author; }, - isEditor : function (){ - return User.isEditor() + isEditor: function () { + return User.isEditor(); }, - subtype: function() { + subtype: function () { return this.post?.post_subtype; }, - post_subtype: function() { + post_subtype: function () { return jx3dat_types?.[this.subtype] || "-"; }, visible: function () { @@ -157,24 +195,24 @@ export default { }, }, methods: { - onCopy: function(val) { + onCopy: function (val) { this.$notify({ title: "订阅号复制成功", message: "复制内容 : " + val.text, type: "success", }); }, - onError: function() { + onError: function () { this.$notify.error({ title: "复制失败", message: "请手动复制", }); }, - updateExtend: function(val) { + updateExtend: function (val) { this.$store.state.extend = val; }, copy(content) { - console.log(content) + console.log(content); navigator.clipboard .writeText(content) .then(() => { @@ -193,7 +231,7 @@ export default { }, }, filters: { - highlight: function(item) { + highlight: function (item) { const colormap = { newbie: "#49c10f", advanced: "#fba524", @@ -205,11 +243,11 @@ export default { } return "#035cc1"; }, - showDown: function(val) { + showDown: function (val) { return val && resolveImagePath(val); }, }, - mounted: function() { + mounted: function () { if (this.id) { this.loading = true; getPost(this.id) @@ -228,11 +266,20 @@ export default { source_id: this.id, link: location.href, title: this.post.post_title, + author_id: this.post.post_author, + banner: this.post.post_banner, }); - this.post.visible > 1 && postReadHistory({ id: this.id, category: "posts", subcategory: "default", visible_type: this.post.visible }); + this.post.visible > 1 && + postReadHistory({ + id: this.id, + category: "posts", + subcategory: "default", + visible_type: this.post.visible, + author_id: this.post.post_author, + banner: this.post.post_banner, + }); } - }) .finally(() => { this.loading = false;