Skip to content

Commit

Permalink
feat: rm auto thx
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaviilee committed Dec 26, 2023
1 parent 78f7a85 commit e1400ce
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 36 deletions.
8 changes: 8 additions & 0 deletions src/components/feed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,28 @@
<script>
import { colors_by_mount_name } from "@jx3box/jx3box-data/data/xf/colors.json";
import { copy } from "@/utils/clipboard";
import { postStat } from "@jx3box/jx3box-common/js/stat";
export default {
name: "feed",
props: ["author", "name", "subtype"],
data: function () {
return {};
},
computed: {
id: function () {
return this.$route.params.id;
},
color: function () {
return colors_by_mount_name?.[this.subtype] === '#FFFFFF' ? '#24292e' : colors_by_mount_name?.[this.subtype];
},
},
methods: {
copy: function (val) {
copy(val, { success_title: "云端宏复制成功" });
this.autoLike();
},
autoLike: function () {
postStat("macro", this.id, "likes");
},
},
mounted: function () {},
Expand Down
78 changes: 42 additions & 36 deletions src/components/macro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
>
<i class="el-icon-video-play"></i> 云端同步刷新
</a>
<el-checkbox
<!-- <el-checkbox
v-if="isLogin"
v-model="auto_thx"
size="mini"
Expand All @@ -50,7 +50,7 @@
:false-label="0"
@change="onAuthThxChange"
>自动感谢</el-checkbox
>
> -->
</div>
<div class="u-count">
字数:
Expand All @@ -74,6 +74,7 @@ import User from "@jx3box/jx3box-common/js/user";
import { copy } from "@/utils/clipboard";
import { reportNow } from "@jx3box/jx3box-common/js/reporter";
import { POST } from "@jx3box/jx3box-comment-ui/src/service";
import { postStat } from "@jx3box/jx3box-common/js/stat";
export default {
name: "macro",
props: ["ctx", "lang", "name", "id", "canComment"],
Expand All @@ -87,7 +88,7 @@ export default {
dict,
isSuperAdmin: User.isSuperAdmin(),
auto_thx: 0,
// auto_thx: 0,
};
},
watch: {
Expand Down Expand Up @@ -146,9 +147,10 @@ export default {
},
});
if (this.auto_thx && User.isLogin() && this.canComment) {
this.autoReply();
}
// if (this.auto_thx && User.isLogin() && this.canComment) {
// this.autoReply();
// }
this.autoLike();
});
},
translate(data) {
Expand Down Expand Up @@ -183,43 +185,47 @@ export default {
run: function () {
this.status = !this.status;
},
onAuthThxChange() {
localStorage.setItem("auto_thx", this.auto_thx);
},
autoReply: function () {
POST(`${this.baseAPI}/comment`, null, {
attachmentList: [],
content: "抱走,谢谢楼主,么么哒#嘴",
is_template: 1,
})
.then((responseJSON) => {
if (responseJSON && ~~responseJSON.code > 0) {
this.$notify({
title: "评论失败",
message: responseJSON.msg || "",
type: "error",
duration: 3000,
position: "bottom-right",
});
return;
}
this.$notify({
title: "",
message: "评论成功!",
type: "success",
duration: 3000,
position: "bottom-right",
});
})
.catch(() => {});
// onAuthThxChange() {
// localStorage.setItem("auto_thx", this.auto_thx);
// },
// autoReply: function () {
// POST(`${this.baseAPI}/comment`, null, {
// attachmentList: [],
// content: "抱走,谢谢楼主,么么哒#嘴",
// is_template: 1,
// })
// .then((responseJSON) => {
// if (responseJSON && ~~responseJSON.code > 0) {
// this.$notify({
// title: "评论失败",
// message: responseJSON.msg || "",
// type: "error",
// duration: 3000,
// position: "bottom-right",
// });
// return;
// }
// this.$notify({
// title: "",
// message: "评论成功!",
// type: "success",
// duration: 3000,
// position: "bottom-right",
// });
// })
// .catch(() => {});
// },
// 自动点赞
autoLike: function () {
postStat("macro", this.id, "likes");
},
},
created: function () {
this.data = this.ctx;
this.code = this.parse(this.ctx);
this.callTranslator();
this.auto_thx = ~~localStorage.getItem("auto_thx") || 0;
// this.auto_thx = ~~localStorage.getItem("auto_thx") || 0;
},
components: {},
};
Expand Down

0 comments on commit e1400ce

Please sign in to comment.