@jx3box/jx3box-common-ui 8.2.1 → 8.2.3
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 +3 -3
- package/service/author.js +13 -3
- package/service/cms.js +2 -5
- package/src/App.vue +3 -3
- package/src/author/AuthorHonor.vue +11 -49
- package/src/author/AuthorInfo.vue +0 -3
- package/src/wiki/WikiComments.vue +39 -69
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jx3box/jx3box-common-ui",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.3",
|
|
4
4
|
"description": "JX3BOX UI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@jx3box/jx3box-comment-ui": "^1.8.7",
|
|
34
|
-
"@jx3box/jx3box-common": "^8.2.
|
|
34
|
+
"@jx3box/jx3box-common": "^8.2.4",
|
|
35
35
|
"@jx3box/jx3box-data": "^3.5.6",
|
|
36
|
-
"@jx3box/jx3box-editor": "^2.1.
|
|
36
|
+
"@jx3box/jx3box-editor": "^2.1.6",
|
|
37
37
|
"@jx3box/reporter": "^0.0.4",
|
|
38
38
|
"axios": "^0.26.1",
|
|
39
39
|
"dayjs": "^1.11.0",
|
package/service/author.js
CHANGED
|
@@ -46,10 +46,19 @@ function getDouyu(ids) {
|
|
|
46
46
|
return res.data.data;
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
// 获取用户勋章
|
|
50
50
|
function getUserMedals(uid) {
|
|
51
51
|
return $next({ mute: true })
|
|
52
|
-
.get("/api/user/" + uid + "/medals")
|
|
52
|
+
.get("/api/next2/user/" + uid + "/medals")
|
|
53
|
+
.then((res) => {
|
|
54
|
+
return res.data.data;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 获取用户称号
|
|
59
|
+
function getUserHonors(uid) {
|
|
60
|
+
return $next({ mute: true })
|
|
61
|
+
.get("/api/next2/user/" + uid + "/honors")
|
|
53
62
|
.then((res) => {
|
|
54
63
|
return res.data.data;
|
|
55
64
|
});
|
|
@@ -92,5 +101,6 @@ export {
|
|
|
92
101
|
getMyInfo,
|
|
93
102
|
userSignIn,
|
|
94
103
|
getFansList,
|
|
95
|
-
getUserInfoByUidOrName
|
|
104
|
+
getUserInfoByUidOrName,
|
|
105
|
+
getUserHonors
|
|
96
106
|
};
|
package/service/cms.js
CHANGED
|
@@ -18,10 +18,6 @@ function getDecorationJson() {
|
|
|
18
18
|
let url = __imgPath + "decoration/index.json";
|
|
19
19
|
return axios.get(url);
|
|
20
20
|
}
|
|
21
|
-
function getHonorJson() {
|
|
22
|
-
let url = __imgPath + "decoration/honor.json";
|
|
23
|
-
return axios.get(url);
|
|
24
|
-
}
|
|
25
21
|
// 通用上传
|
|
26
22
|
function upload(formData) {
|
|
27
23
|
return $cms().post(`/api/cms/upload`, formData);
|
|
@@ -77,4 +73,5 @@ function setUserMeta(key,data) {
|
|
|
77
73
|
return $cms().post(`/api/cms/user/my/meta?key=${key}`, data);
|
|
78
74
|
}
|
|
79
75
|
|
|
80
|
-
export { getPostAuthors, uploadImage, upload, getDecoration, getDecorationJson, checkTeamMember,
|
|
76
|
+
export { getPostAuthors, uploadImage, upload, getDecoration, getDecorationJson, checkTeamMember,
|
|
77
|
+
getSliders, getCollection, getTopicBucket, getConfig, getUserMeta, setUserMeta };
|
package/src/App.vue
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
bread info
|
|
16
16
|
</Breadcrumb>
|
|
17
17
|
|
|
18
|
-
<LeftSidebar :open="true" :uid="
|
|
18
|
+
<LeftSidebar :open="true" :uid="1005">
|
|
19
19
|
<LeftSideToggle :mobileOnly="true" />
|
|
20
|
-
<Author :author="author" :uid="
|
|
20
|
+
<Author :author="author" :uid="1005" />
|
|
21
21
|
</LeftSidebar>
|
|
22
22
|
|
|
23
23
|
<Main :withoutLeft="false" :withoutRight="false">
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
<WikiRevisions type="achievement" source-id="2996" />
|
|
101
101
|
<hr />
|
|
102
102
|
|
|
103
|
-
<WikiComments type="achievement" source-id="
|
|
103
|
+
<WikiComments type="achievement" source-id="456" />
|
|
104
104
|
<hr />
|
|
105
105
|
</el-tab-pane>
|
|
106
106
|
<el-tab-pane label="头像" name="avatar">
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="c-author-honor" :style="{ backgroundImage: `url(${imgUrl()})` }" v-if="honor">
|
|
3
|
-
<span v-if="!isJdt" :style="{ color: honor.color }">{{
|
|
3
|
+
<span v-if="!isJdt" :style="{ color: honor.color }">{{ honorName }}</span>
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
6
|
<script>
|
|
7
7
|
import { __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
8
|
-
import {
|
|
9
|
-
import { inRange } from "lodash";
|
|
8
|
+
import { getUserHonors } from "../../service/author";
|
|
10
9
|
const HONOR_IMG_KEY = "honor_img";
|
|
11
10
|
export default {
|
|
12
11
|
props: ["uid"],
|
|
@@ -26,16 +25,16 @@ export default {
|
|
|
26
25
|
computed: {
|
|
27
26
|
isJdt() {
|
|
28
27
|
return this.honor?.val?.toLowerCase()?.includes('jdt')
|
|
28
|
+
},
|
|
29
|
+
honorName({ honor }) {
|
|
30
|
+
return `${honor.year}${honor.prefix}${honor.suffix}`
|
|
29
31
|
}
|
|
30
32
|
},
|
|
31
33
|
methods: {
|
|
32
34
|
imgUrl: function () {
|
|
33
35
|
let item = this.honor;
|
|
34
36
|
if (!item) return;
|
|
35
|
-
|
|
36
|
-
return __imgPath + `decoration/honor/${item.val}/${item.val}_${item.imgIndex}.${item.ext}`;
|
|
37
|
-
}
|
|
38
|
-
return __imgPath + `decoration/honor/${item.val}/${item.val}.${item.ext}`;
|
|
37
|
+
return __imgPath + `decoration/honor/${item.img}/${item.img}.${item.img_ext}`;
|
|
39
38
|
},
|
|
40
39
|
getHonor() {
|
|
41
40
|
let user_id = this.uid;
|
|
@@ -46,8 +45,8 @@ export default {
|
|
|
46
45
|
try {
|
|
47
46
|
this.honor = JSON.parse(honor_local);
|
|
48
47
|
} catch (err) {
|
|
49
|
-
|
|
50
|
-
let res = data
|
|
48
|
+
getUserHonors(user_id).then((data) => {
|
|
49
|
+
let res = data?.filter(item => item.using);
|
|
51
50
|
if (res.length == 0) {
|
|
52
51
|
//空 则为无主题,不再加载接口,界面设No
|
|
53
52
|
sessionStorage.setItem(HONOR_IMG_KEY + user_id, "no");
|
|
@@ -60,46 +59,9 @@ export default {
|
|
|
60
59
|
},
|
|
61
60
|
//有称号后,获取样式配置
|
|
62
61
|
getHonorStyle(data) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
let prefix = honorConfig.prefix;
|
|
67
|
-
let regPrefix = honorConfig.prefix.match(/\{([^{}]+?)\}/g);
|
|
68
|
-
let ranking = honorConfig.ranking;
|
|
69
|
-
let honorStr = honorConfig.year || "";
|
|
70
|
-
if (regPrefix) {
|
|
71
|
-
honorStr = honorStr + (data[regPrefix[0].slice(1, -1)] || "");
|
|
72
|
-
} else {
|
|
73
|
-
honorStr = honorStr + prefix;
|
|
74
|
-
}
|
|
75
|
-
if (ranking.length > 0) {
|
|
76
|
-
data.imgIndex = 0;
|
|
77
|
-
for (let i = 0; i < ranking.length; i++) {
|
|
78
|
-
if (data.ranking !== undefined && inRange(Number(data.ranking), ranking[i][0], ranking[i][1])) {
|
|
79
|
-
data.imgIndex = i;
|
|
80
|
-
let str = ranking[i][2];
|
|
81
|
-
let regStr = str.match(/\{([^{}]+?)\}/g);
|
|
82
|
-
if (regStr) {
|
|
83
|
-
honorStr =
|
|
84
|
-
honorStr +
|
|
85
|
-
str.replace(/\{([^{}]+?)\}/g, function (match, p1) {
|
|
86
|
-
return data[p1] || "";
|
|
87
|
-
});
|
|
88
|
-
} else {
|
|
89
|
-
honorStr = honorStr + str;
|
|
90
|
-
}
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
data.honor = honorStr + honorConfig.suffix;
|
|
96
|
-
data.color = honorConfig.color;
|
|
97
|
-
data.ext = honorConfig.ext;
|
|
98
|
-
data.isHave = true;
|
|
99
|
-
data.isImgIndex = ranking.length > 0;
|
|
100
|
-
sessionStorage.setItem(HONOR_IMG_KEY + this.uid, JSON.stringify(data));
|
|
101
|
-
this.honor = data;
|
|
102
|
-
});
|
|
62
|
+
data = data.honor;
|
|
63
|
+
sessionStorage.setItem(HONOR_IMG_KEY + this.uid, JSON.stringify(data));
|
|
64
|
+
this.honor = data;
|
|
103
65
|
},
|
|
104
66
|
},
|
|
105
67
|
};
|
|
@@ -45,11 +45,8 @@ import { __server, __imgPath, __userLevel, __userLevelColor } from "@jx3box/jx3b
|
|
|
45
45
|
import { authorLink } from "@jx3box/jx3box-common/js/utils";
|
|
46
46
|
import User from "@jx3box/jx3box-common/js/user";
|
|
47
47
|
import { getUserInfo } from "../../service/author";
|
|
48
|
-
import { getDecoration, getHonorJson } from "../../service/cms";
|
|
49
48
|
import Avatar from "./Avatar.vue";
|
|
50
49
|
import Honor from "./AuthorHonor.vue";
|
|
51
|
-
import { cloneDeep, inRange } from "lodash";
|
|
52
|
-
const HONOR_IMG_KEY = "honor_img";
|
|
53
50
|
export default {
|
|
54
51
|
name: "AuthorInfo",
|
|
55
52
|
props: ["uid"],
|
|
@@ -29,19 +29,12 @@
|
|
|
29
29
|
<i class="el-icon-chat-dot-round"></i>
|
|
30
30
|
<span>回复</span>
|
|
31
31
|
</h4>
|
|
32
|
-
<textarea
|
|
33
|
-
class="u-reply-content"
|
|
34
|
-
v-model="reply_form.content"
|
|
35
|
-
></textarea>
|
|
32
|
+
<textarea class="u-reply-content" v-model="reply_form.content"></textarea>
|
|
36
33
|
<div class="u-author">
|
|
37
34
|
<span>昵称:</span>
|
|
38
35
|
<input v-model="reply_form.user_nickname" type="text" />
|
|
39
36
|
</div>
|
|
40
|
-
<el-button
|
|
41
|
-
type="primary"
|
|
42
|
-
class="u-submit"
|
|
43
|
-
@click="create_comment(reply_form)"
|
|
44
|
-
>
|
|
37
|
+
<el-button type="primary" class="u-submit" @click="create_comment(reply_form)">
|
|
45
38
|
<i class="el-icon-check"></i>
|
|
46
39
|
<span>提交</span>
|
|
47
40
|
</el-button>
|
|
@@ -54,7 +47,7 @@
|
|
|
54
47
|
<script>
|
|
55
48
|
import WikiPanel from "./WikiPanel";
|
|
56
49
|
import Comment from "./WikiComment.vue";
|
|
57
|
-
import { wikiComment } from "@jx3box/jx3box-common/js/
|
|
50
|
+
import { wikiComment } from "@jx3box/jx3box-common/js/wiki_v2";
|
|
58
51
|
import User from "@jx3box/jx3box-common/js/user";
|
|
59
52
|
|
|
60
53
|
export default {
|
|
@@ -81,33 +74,25 @@ export default {
|
|
|
81
74
|
methods: {
|
|
82
75
|
get_comments() {
|
|
83
76
|
if (!this.type || !this.sourceId) return;
|
|
84
|
-
// WikiComment.list(this.type, this.sourceId, this.client)
|
|
85
77
|
this.loading = true;
|
|
86
|
-
wikiComment
|
|
87
|
-
|
|
88
|
-
(res) => {
|
|
78
|
+
wikiComment
|
|
79
|
+
.list({ type: this.type, id: this.sourceId }, { client: this.client, page: this.page })
|
|
80
|
+
.then((res) => {
|
|
89
81
|
res = res.data;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
this.page = res.data.current_page;
|
|
100
|
-
this.total = res.data.total
|
|
101
|
-
this.comments = filter(comments, 0);
|
|
102
|
-
// this.comments = comments;
|
|
103
|
-
this.loading = false;
|
|
82
|
+
let comments = res.data.list;
|
|
83
|
+
for (let i = 0; i < comments.length; i++) {
|
|
84
|
+
comments[i]["reply_form"] = {
|
|
85
|
+
show: false,
|
|
86
|
+
content: "",
|
|
87
|
+
user_nickname: User.getInfo().name,
|
|
88
|
+
};
|
|
104
89
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
this.comments =
|
|
90
|
+
this.page = res.data.page;
|
|
91
|
+
this.total = res.data.total;
|
|
92
|
+
this.comments = filter(comments, 0);
|
|
93
|
+
// this.comments = comments;
|
|
108
94
|
this.loading = false;
|
|
109
|
-
}
|
|
110
|
-
);
|
|
95
|
+
});
|
|
111
96
|
|
|
112
97
|
function filter(comments, parent) {
|
|
113
98
|
let outputs = [];
|
|
@@ -122,13 +107,13 @@ export default {
|
|
|
122
107
|
user_id: c.user_id,
|
|
123
108
|
user_nickname: c.user_nickname,
|
|
124
109
|
id: c.id,
|
|
125
|
-
}
|
|
110
|
+
};
|
|
126
111
|
item.reply_form = {
|
|
127
112
|
show: false,
|
|
128
113
|
content: "",
|
|
129
114
|
user_nickname: User.getInfo().name,
|
|
130
|
-
}
|
|
131
|
-
return item
|
|
115
|
+
};
|
|
116
|
+
return item;
|
|
132
117
|
});
|
|
133
118
|
outputs.push(c);
|
|
134
119
|
}
|
|
@@ -146,38 +131,23 @@ export default {
|
|
|
146
131
|
return;
|
|
147
132
|
}
|
|
148
133
|
const data = {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
type: "success",
|
|
167
|
-
});
|
|
168
|
-
} else
|
|
169
|
-
this.$message({
|
|
170
|
-
message: `${res.message}`,
|
|
171
|
-
type: "warning",
|
|
172
|
-
});
|
|
173
|
-
},
|
|
174
|
-
() => {
|
|
175
|
-
this.$message({
|
|
176
|
-
message: "网络异常,提交失败",
|
|
177
|
-
type: "warning",
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
)
|
|
134
|
+
type: this.type,
|
|
135
|
+
source_id: this.sourceId,
|
|
136
|
+
parent_id: parent_id,
|
|
137
|
+
user_nickname: form.user_nickname || User.getInfo().name,
|
|
138
|
+
content: form.content,
|
|
139
|
+
client: this.client,
|
|
140
|
+
};
|
|
141
|
+
wikiComment
|
|
142
|
+
.post(data)
|
|
143
|
+
.then((res) => {
|
|
144
|
+
res = res.data;
|
|
145
|
+
form.content = "";
|
|
146
|
+
this.$message({
|
|
147
|
+
message: "提交成功,请等待审核",
|
|
148
|
+
type: "success",
|
|
149
|
+
});
|
|
150
|
+
})
|
|
181
151
|
.finally(() => {
|
|
182
152
|
form.show = false;
|
|
183
153
|
});
|
|
@@ -185,7 +155,7 @@ export default {
|
|
|
185
155
|
handleCurrentChange(page) {
|
|
186
156
|
this.page = page;
|
|
187
157
|
this.get_comments();
|
|
188
|
-
}
|
|
158
|
+
},
|
|
189
159
|
},
|
|
190
160
|
components: {
|
|
191
161
|
WikiPanel,
|