@jx3box/jx3box-common-ui 9.4.8 → 9.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/wiki/WikiComment.vue +38 -0
- package/src/wiki/WikiComments.vue +16 -0
package/package.json
CHANGED
package/src/wiki/WikiComment.vue
CHANGED
|
@@ -57,6 +57,10 @@
|
|
|
57
57
|
<i class="el-icon-chat-dot-round"></i>
|
|
58
58
|
<span>回复</span>
|
|
59
59
|
</el-button>
|
|
60
|
+
<template v-if="isEditor && !comment.parent_id">
|
|
61
|
+
<el-button type="primary" class="u-reply" @click="onStar(comment)" plain :icon="comment.is_star ? 'el-icon-star-on' : 'el-icon-star-off'">{{ comment.is_star ? '取消加精' : '加精' }}</el-button>
|
|
62
|
+
<el-button type="primary" class="u-reply" @click="onTop(comment)" plain icon="el-icon-top">{{ comment.is_top ? '取消置顶' : '置顶' }}</el-button>
|
|
63
|
+
</template>
|
|
60
64
|
<!-- 更新时间 -->
|
|
61
65
|
<span
|
|
62
66
|
class="u-time"
|
|
@@ -97,10 +101,16 @@
|
|
|
97
101
|
|
|
98
102
|
<script>
|
|
99
103
|
import { authorLink, ts2str } from "@jx3box/jx3box-common/js/utils";
|
|
104
|
+
import User from "@jx3box/jx3box-common/js/user";
|
|
100
105
|
|
|
101
106
|
export default {
|
|
102
107
|
name: "WikiComment",
|
|
103
108
|
props: ["comments", "sourceId"],
|
|
109
|
+
computed: {
|
|
110
|
+
isEditor() {
|
|
111
|
+
return User.isEditor();
|
|
112
|
+
},
|
|
113
|
+
},
|
|
104
114
|
methods: {
|
|
105
115
|
author_url: authorLink,
|
|
106
116
|
ts2str,
|
|
@@ -116,6 +126,34 @@ export default {
|
|
|
116
126
|
}
|
|
117
127
|
app.create_comment(form, parent_id);
|
|
118
128
|
},
|
|
129
|
+
isParent(comment) {
|
|
130
|
+
return !comment.parent_id;
|
|
131
|
+
},
|
|
132
|
+
onStar(comment) {
|
|
133
|
+
let app = this.$parent;
|
|
134
|
+
if (!app.star_comment) app = app.$parent;
|
|
135
|
+
if (!app.star_comment) {
|
|
136
|
+
this.$message({
|
|
137
|
+
message: "操作异常,请联系管理员",
|
|
138
|
+
type: "warning",
|
|
139
|
+
});
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
app.star_comment(comment, comment.is_star ? 0 : 1);
|
|
143
|
+
|
|
144
|
+
},
|
|
145
|
+
onTop(comment) {
|
|
146
|
+
let app = this.$parent;
|
|
147
|
+
if (!app.top_comment) app = app.$parent;
|
|
148
|
+
if (!app.top_comment) {
|
|
149
|
+
this.$message({
|
|
150
|
+
message: "操作异常,请联系管理员",
|
|
151
|
+
type: "warning",
|
|
152
|
+
});
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
app.top_comment(comment, comment.is_top ? 0 : 1);
|
|
156
|
+
}
|
|
119
157
|
},
|
|
120
158
|
};
|
|
121
159
|
</script>
|
|
@@ -156,6 +156,22 @@ export default {
|
|
|
156
156
|
this.page = page;
|
|
157
157
|
this.get_comments();
|
|
158
158
|
},
|
|
159
|
+
star_comment(comment, is_star) {
|
|
160
|
+
wikiComment.star(comment.id, {
|
|
161
|
+
is_star
|
|
162
|
+
}).then(() => {
|
|
163
|
+
this.page = 1; // 重置页码
|
|
164
|
+
this.get_comments();
|
|
165
|
+
});
|
|
166
|
+
},
|
|
167
|
+
top_comment(comment, is_top) {
|
|
168
|
+
wikiComment.top(comment.id, {
|
|
169
|
+
is_top
|
|
170
|
+
}).then(() => {
|
|
171
|
+
this.page = 1; // 重置页码
|
|
172
|
+
this.get_comments();
|
|
173
|
+
});
|
|
174
|
+
},
|
|
159
175
|
},
|
|
160
176
|
components: {
|
|
161
177
|
WikiPanel,
|