@jx3box/jx3box-common-ui 9.2.1 → 9.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 -2
- package/service/commit-history.js +19 -0
- package/src/App.vue +21 -13
- package/src/single/PostVersion.vue +160 -0
- package/src/single/Thx.vue +5 -1
- package/src/single/VersionDialog.vue +235 -0
- package/src/single/cms-single.vue +11 -5
- package/src/single/right-affix.vue +11 -21
- package/vue.config.js +21 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jx3box/jx3box-common-ui",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.3",
|
|
4
4
|
"description": "JX3BOX UI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@jx3box/jx3box-comment-ui": "^2.0.3",
|
|
35
35
|
"@jx3box/jx3box-common": "^8.6.3",
|
|
36
36
|
"@jx3box/jx3box-data": "^3.7.7",
|
|
37
|
-
"@jx3box/jx3box-editor": "^2.2.
|
|
37
|
+
"@jx3box/jx3box-editor": "^2.2.25",
|
|
38
38
|
"@jx3box/reporter": "^0.0.4",
|
|
39
39
|
"axios": "^0.26.1",
|
|
40
40
|
"dayjs": "^1.11.0",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"lodash": "^4.17.15",
|
|
44
44
|
"qrcode.vue": "^1.7.0",
|
|
45
45
|
"url": "^0.11.0",
|
|
46
|
+
"v-code-diff": "^1.13.1",
|
|
46
47
|
"vue": "^2.6.11"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { $next } from "@jx3box/jx3box-common/js/https";
|
|
2
|
+
|
|
3
|
+
// 获取提交记录
|
|
4
|
+
export function getCommitHistories(id, params) {
|
|
5
|
+
return $next({ proxy: true }).get(`/api/next2/userdata/commit-history/content-meta/${id}/commit/history`, {
|
|
6
|
+
params,
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// 通过hash获取提交记录
|
|
11
|
+
export function getCommitByHash(id, hash) {
|
|
12
|
+
return $next({ proxy: true }).get(`/api/next2/userdata/commit-history/content-meta/${id}/commit/by-hash/${hash}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// 提交
|
|
16
|
+
export function commitHistory(id, data) {
|
|
17
|
+
// { domain: "https://dev.next2.jx3box.com" }
|
|
18
|
+
return $next({ proxy: true }).post(`/api/next2/userdata/commit-history/content-meta/${id}/commit`, data);
|
|
19
|
+
}
|
package/src/App.vue
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<img slot="logo" svg-inline src="../assets/img/jx3.svg" />
|
|
15
15
|
bread info
|
|
16
16
|
<template #op-prepend>
|
|
17
|
-
<AdminDrop :post="community" :isCommunity="true" :user-id="8" :showMove="true"/>
|
|
17
|
+
<AdminDrop :post="community" :isCommunity="true" :user-id="8" :showMove="true" />
|
|
18
18
|
</template>
|
|
19
19
|
</Breadcrumb>
|
|
20
20
|
|
|
@@ -23,16 +23,15 @@
|
|
|
23
23
|
<Author :author="author" :uid="8" />
|
|
24
24
|
</LeftSidebar>
|
|
25
25
|
|
|
26
|
-
<Main :withoutLeft="false" :withoutRight="false" style="padding:20px
|
|
26
|
+
<Main :withoutLeft="false" :withoutRight="false" style="padding: 20px">
|
|
27
27
|
<el-tabs v-model="tab" type="card">
|
|
28
|
-
|
|
29
28
|
<el-tab-pane label="通用组件" name="widget">
|
|
30
29
|
<!-- <PostHeader :post="post" /> -->
|
|
31
30
|
<!-- <Creators :postId="30432" style="margin-bottom: 10px" /> -->
|
|
32
31
|
<!-- <Collection :id="59" :defaultVisible="true" /> -->
|
|
33
32
|
<UserPop title="添加用户" v-model="visible" @confirm="addUser" />
|
|
34
33
|
<el-button @click="visible = true">用户POP</el-button>
|
|
35
|
-
<el-button @click="homeworkVisible=true">作业组件</el-button>
|
|
34
|
+
<el-button @click="homeworkVisible = true">作业组件</el-button>
|
|
36
35
|
<!-- :postId="23865" -->
|
|
37
36
|
<!-- <Thx
|
|
38
37
|
postType="bps"
|
|
@@ -52,7 +51,13 @@
|
|
|
52
51
|
<QRcode />
|
|
53
52
|
<Sharing />
|
|
54
53
|
|
|
55
|
-
<homework
|
|
54
|
+
<homework
|
|
55
|
+
v-model="homeworkVisible"
|
|
56
|
+
post-type="comment"
|
|
57
|
+
:post-id="19382"
|
|
58
|
+
:userId="8719"
|
|
59
|
+
client="std"
|
|
60
|
+
></homework>
|
|
56
61
|
|
|
57
62
|
<PostGuide :post="post" />
|
|
58
63
|
|
|
@@ -115,7 +120,7 @@
|
|
|
115
120
|
</el-tab-pane>
|
|
116
121
|
|
|
117
122
|
<el-tab-pane label="头像" name="avatar">
|
|
118
|
-
<el-radio-group v-model="avatar_size" style="margin-bottom:10px
|
|
123
|
+
<el-radio-group v-model="avatar_size" style="margin-bottom: 10px">
|
|
119
124
|
<el-radio label="xxs">xxs-36/48</el-radio>
|
|
120
125
|
<el-radio label="xs">xs-48/68</el-radio>
|
|
121
126
|
<el-radio label="s">s-68/88</el-radio>
|
|
@@ -134,10 +139,11 @@
|
|
|
134
139
|
</el-tab-pane>
|
|
135
140
|
</el-tabs>
|
|
136
141
|
|
|
137
|
-
<RightSidebar :showToggle="false" style="padding:15px
|
|
142
|
+
<RightSidebar :showToggle="false" style="padding: 15px">
|
|
138
143
|
<RightSideMsg>Hello</RightSideMsg>
|
|
139
144
|
<PostTopic></PostTopic>
|
|
140
145
|
<div id="directory"></div>
|
|
146
|
+
<PostVersion :post="post"></PostVersion>
|
|
141
147
|
<PostCollection :id="59" />
|
|
142
148
|
</RightSidebar>
|
|
143
149
|
|
|
@@ -162,6 +168,7 @@ import Main from "./Main.vue";
|
|
|
162
168
|
import RightSidebar from "./RightSidebar.vue";
|
|
163
169
|
import RightSideMsg from "./RightSideMsg.vue";
|
|
164
170
|
import PostTopic from "./single/PostTopic.vue";
|
|
171
|
+
import PostVersion from "./single/PostVersion.vue";
|
|
165
172
|
|
|
166
173
|
import Footer from "./Footer.vue";
|
|
167
174
|
import Bottom from "./Bottom.vue";
|
|
@@ -203,8 +210,8 @@ import axios from "axios";
|
|
|
203
210
|
import { __server } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
204
211
|
import { wiki } from "@jx3box/jx3box-common/js/wiki";
|
|
205
212
|
import post_topics from "@jx3box/jx3box-common/data/post_topics.json";
|
|
206
|
-
import Homework from
|
|
207
|
-
import { getTopicDetails } from "../service/community"
|
|
213
|
+
import Homework from "./interact/Homework.vue";
|
|
214
|
+
import { getTopicDetails } from "../service/community";
|
|
208
215
|
|
|
209
216
|
import { isMiniProgram, miniprogramHack } from "@jx3box/jx3box-common/js/utils";
|
|
210
217
|
|
|
@@ -225,6 +232,7 @@ export default {
|
|
|
225
232
|
// cmsList,
|
|
226
233
|
singlebox,
|
|
227
234
|
// PostHeader,
|
|
235
|
+
PostVersion,
|
|
228
236
|
PostCollection,
|
|
229
237
|
PostTopic,
|
|
230
238
|
|
|
@@ -271,7 +279,7 @@ export default {
|
|
|
271
279
|
tab: "post",
|
|
272
280
|
|
|
273
281
|
post: {},
|
|
274
|
-
post_id: "
|
|
282
|
+
post_id: "96614",
|
|
275
283
|
|
|
276
284
|
author: "",
|
|
277
285
|
wikiPost: null,
|
|
@@ -283,12 +291,12 @@ export default {
|
|
|
283
291
|
upload: "",
|
|
284
292
|
text: `<Text>text="使用:<BUFF 3222 1 desc>,持续<BUFF 3222 1 time>。\\\n" font=105 </text><Text>text="红豆沙做馅儿,精致细腻的广式月饼。" font=100 </text><Text>text="使用:能在唐门套装供应商处换取如下装备。\\\n" font=105 </text><Text>text="[燕云·重泉靴]" name="iteminfolink" eventid=513 script="this.nVersion=0 this.dwTabType=7 this.dwIndex=35244 this.OnItemLButtonDown=function() OnItemLinkDown(this) end" font=100 r=255 g=40 b=255 </text><Text>text="," font=105 </text><Text>text="[燕云·铭松靴]" name="iteminfolink" eventid=513 script="this.nVersion=0 this.dwTabType=7 this.dwIndex=35245 this.OnItemLButtonDown=function() OnItemLinkDown(this) end" font=100 r=255 g=40 b=255 </text><Text>text="。" font=100 </text>`,
|
|
285
293
|
|
|
286
|
-
post_topics: post_topics[
|
|
287
|
-
tag2:
|
|
294
|
+
post_topics: post_topics["pve"],
|
|
295
|
+
tag2: "",
|
|
288
296
|
|
|
289
297
|
homeworkVisible: false,
|
|
290
298
|
|
|
291
|
-
community: {}
|
|
299
|
+
community: {},
|
|
292
300
|
};
|
|
293
301
|
},
|
|
294
302
|
created: function () {
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="m-post-version" v-if="list && list.length">
|
|
3
|
+
<div class="m-title">
|
|
4
|
+
<div class="u-title"><i class="el-icon-time"></i> 历史版本</div>
|
|
5
|
+
<div class="u-op" @click="toggle"><i class="el-icon-d-caret"></i> 折叠</div>
|
|
6
|
+
</div>
|
|
7
|
+
<ul v-show="show" class="u-list">
|
|
8
|
+
<!-- <el-button @click="onAdd">创建</el-button> -->
|
|
9
|
+
<li v-for="(item, i) in list" class="u-item" :key="i">
|
|
10
|
+
<div class="u-version">
|
|
11
|
+
<span>{{ item.version }}</span> - <span>{{ item.created_at }}</span>
|
|
12
|
+
</div>
|
|
13
|
+
<el-button size="small" type="text" @click="handleContrast(item)">对比</el-button>
|
|
14
|
+
</li>
|
|
15
|
+
</ul>
|
|
16
|
+
<el-pagination small layout="prev, pager, next" :total="total" :current-page.sync="index" hide-on-single-page>
|
|
17
|
+
</el-pagination>
|
|
18
|
+
<version-dialog
|
|
19
|
+
v-if="visible"
|
|
20
|
+
v-model="visible"
|
|
21
|
+
:link_content_meta_id="link_content_meta_id"
|
|
22
|
+
:title="title"
|
|
23
|
+
:content="content"
|
|
24
|
+
:commit_hash="commit_hash"
|
|
25
|
+
:versions="list"
|
|
26
|
+
></version-dialog>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
import { getCommitHistories, commitHistory } from "../../service/commit-history";
|
|
32
|
+
import VersionDialog from "./VersionDialog.vue";
|
|
33
|
+
export default {
|
|
34
|
+
name: "PostVersion",
|
|
35
|
+
props: ["post"],
|
|
36
|
+
components: { VersionDialog },
|
|
37
|
+
data() {
|
|
38
|
+
return {
|
|
39
|
+
loading: false,
|
|
40
|
+
index: 1,
|
|
41
|
+
pageSize: 50,
|
|
42
|
+
total: 0,
|
|
43
|
+
list: [],
|
|
44
|
+
show: true,
|
|
45
|
+
visible: false,
|
|
46
|
+
commit_hash: "",
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
computed: {
|
|
50
|
+
link_content_meta_id() {
|
|
51
|
+
return this.post?.link_content_meta_id || 0;
|
|
52
|
+
},
|
|
53
|
+
content() {
|
|
54
|
+
return this.post?.post_content || "";
|
|
55
|
+
},
|
|
56
|
+
title() {
|
|
57
|
+
return this.post?.post_title || "";
|
|
58
|
+
},
|
|
59
|
+
pageParams() {
|
|
60
|
+
return {
|
|
61
|
+
index: this.index,
|
|
62
|
+
pageSize: this.pageSize,
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
watch: {
|
|
67
|
+
link_content_meta_id: {
|
|
68
|
+
immediate: true,
|
|
69
|
+
handler: function (val) {
|
|
70
|
+
!!val && this.load();
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
page() {
|
|
74
|
+
this.load();
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
methods: {
|
|
78
|
+
onAdd() {
|
|
79
|
+
commitHistory(this.link_content_meta_id, {
|
|
80
|
+
commit: "提交测试4",
|
|
81
|
+
content: `每日机缘4`,
|
|
82
|
+
})
|
|
83
|
+
.then((res) => {
|
|
84
|
+
this.$message.success("创建成功");
|
|
85
|
+
this.load();
|
|
86
|
+
})
|
|
87
|
+
.catch((err) => {
|
|
88
|
+
this.$message.error(err.message);
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
handleContrast(item) {
|
|
92
|
+
this.commit_hash = item.commit_hash;
|
|
93
|
+
this.visible = true;
|
|
94
|
+
},
|
|
95
|
+
load() {
|
|
96
|
+
this.loading = true;
|
|
97
|
+
getCommitHistories(this.link_content_meta_id, this.pageParams)
|
|
98
|
+
.then((res) => {
|
|
99
|
+
const list = res.data?.data?.list || [];
|
|
100
|
+
if (list.length) {
|
|
101
|
+
this.list = list.map((item, i) => {
|
|
102
|
+
return {
|
|
103
|
+
...item,
|
|
104
|
+
version: "v" + (list.length - i),
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
this.total = res.data?.data?.page?.total || 0;
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
.finally(() => {
|
|
111
|
+
this.loading = false;
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
toggle() {
|
|
115
|
+
this.show = !this.show;
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
</script>
|
|
120
|
+
<style scoped lang="less">
|
|
121
|
+
.m-post-version {
|
|
122
|
+
.m-title {
|
|
123
|
+
.flex;
|
|
124
|
+
justify-content: space-between;
|
|
125
|
+
align-items: center;
|
|
126
|
+
margin-bottom: 5px;
|
|
127
|
+
.u-op {
|
|
128
|
+
font-size: 14px;
|
|
129
|
+
float: right;
|
|
130
|
+
padding: 0 5px;
|
|
131
|
+
line-height: 25px;
|
|
132
|
+
color: #cdd1db;
|
|
133
|
+
cursor: pointer;
|
|
134
|
+
&:hover {
|
|
135
|
+
color: #a1a9bb;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
.u-title {
|
|
140
|
+
font-weight: 300;
|
|
141
|
+
font-size: 20px;
|
|
142
|
+
}
|
|
143
|
+
.u-list {
|
|
144
|
+
list-style: none;
|
|
145
|
+
padding: 10px 20px;
|
|
146
|
+
margin: 0;
|
|
147
|
+
li {
|
|
148
|
+
.fz(13px, 36px);
|
|
149
|
+
.flex;
|
|
150
|
+
justify-content: space-between;
|
|
151
|
+
align-items: center;
|
|
152
|
+
transition: 0.15s ease-in-out;
|
|
153
|
+
.nobreak;
|
|
154
|
+
&:hover {
|
|
155
|
+
background-color: #e6f0fb;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
</style>
|
package/src/single/Thx.vue
CHANGED
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
:category="category"
|
|
53
53
|
@updateRecord="updateRecord"
|
|
54
54
|
/>
|
|
55
|
-
<watch-later :category="postType" :title="postTitle" :author-id="authorId" :banner="banner" :content-id="
|
|
55
|
+
<watch-later :category="postType" :title="postTitle" :author-id="authorId" :banner="banner" :content-id="contentMetaId"></watch-later>
|
|
56
56
|
<Share :postId="postId" :postType="postType" :client="client" />
|
|
57
57
|
</div>
|
|
58
58
|
<div class="w-thx-records">
|
|
@@ -148,6 +148,10 @@ export default {
|
|
|
148
148
|
type: String,
|
|
149
149
|
default: "",
|
|
150
150
|
},
|
|
151
|
+
contentMetaId: {
|
|
152
|
+
type: Number,
|
|
153
|
+
default: 0,
|
|
154
|
+
},
|
|
151
155
|
},
|
|
152
156
|
components: {
|
|
153
157
|
Like,
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog
|
|
3
|
+
custom-class="m-version-contrast-dialog"
|
|
4
|
+
:title="`版本比对 - ${title}`"
|
|
5
|
+
:visible="modelValue"
|
|
6
|
+
append-to-body
|
|
7
|
+
width="90%"
|
|
8
|
+
@close="close"
|
|
9
|
+
>
|
|
10
|
+
<div class="m-version-container" v-loading="loading">
|
|
11
|
+
<div class="m-toolbar">
|
|
12
|
+
<el-radio-group v-model="type">
|
|
13
|
+
<el-radio-button :label="item.value" v-for="item in types" :key="item.value">{{
|
|
14
|
+
item.label
|
|
15
|
+
}}</el-radio-button>
|
|
16
|
+
</el-radio-group>
|
|
17
|
+
<div class="m-select">
|
|
18
|
+
<el-select
|
|
19
|
+
class="u-select"
|
|
20
|
+
v-model="version1"
|
|
21
|
+
placeholder="请选择版本1"
|
|
22
|
+
@change="versionChange($event, 1)"
|
|
23
|
+
>
|
|
24
|
+
<el-option
|
|
25
|
+
v-for="item in versions"
|
|
26
|
+
:key="item.id"
|
|
27
|
+
:label="item.version"
|
|
28
|
+
:value="item.commit_hash"
|
|
29
|
+
></el-option>
|
|
30
|
+
<template v-slot:prefix>
|
|
31
|
+
<span class="u-label">版本1</span>
|
|
32
|
+
</template>
|
|
33
|
+
</el-select>
|
|
34
|
+
<el-select
|
|
35
|
+
class="u-select"
|
|
36
|
+
v-model="version2"
|
|
37
|
+
placeholder="请选择版本2"
|
|
38
|
+
@change="versionChange($event, 2)"
|
|
39
|
+
>
|
|
40
|
+
<el-option
|
|
41
|
+
v-for="item in versions"
|
|
42
|
+
:key="item.id"
|
|
43
|
+
:label="item.version"
|
|
44
|
+
:value="item.commit_hash"
|
|
45
|
+
></el-option>
|
|
46
|
+
<template v-slot:prefix> <span class="u-label">版本2</span> </template>
|
|
47
|
+
</el-select>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<div v-if="type === 'view'" class="m-content-container">
|
|
51
|
+
<div class="u-content">
|
|
52
|
+
<Article :content="content1" />
|
|
53
|
+
</div>
|
|
54
|
+
<div class="u-content">
|
|
55
|
+
<Article :content="content2" />
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
<div v-if="type === 'code'" class="m-content-container">
|
|
59
|
+
<code-diff
|
|
60
|
+
class="m-content-view"
|
|
61
|
+
:old-string="content1"
|
|
62
|
+
:new-string="content2"
|
|
63
|
+
:context="1024"
|
|
64
|
+
output-format="side-by-side"
|
|
65
|
+
maxHeight="520px"
|
|
66
|
+
:filename="`${content1Len}字`"
|
|
67
|
+
:newFilename="`${content2Len}字`"
|
|
68
|
+
ignoreMatchingLines="data:image/png;base64,"
|
|
69
|
+
></code-diff>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</el-dialog>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<script>
|
|
76
|
+
import { getCommitByHash } from "../../service/commit-history";
|
|
77
|
+
import Article from "@jx3box/jx3box-editor/src/Article.vue";
|
|
78
|
+
import { CodeDiff } from "v-code-diff";
|
|
79
|
+
export default {
|
|
80
|
+
name: "VersionDialog",
|
|
81
|
+
components: {
|
|
82
|
+
CodeDiff,
|
|
83
|
+
Article,
|
|
84
|
+
},
|
|
85
|
+
props: {
|
|
86
|
+
modelValue: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: false,
|
|
89
|
+
},
|
|
90
|
+
title: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: "",
|
|
93
|
+
},
|
|
94
|
+
content: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: "",
|
|
97
|
+
},
|
|
98
|
+
commit_hash: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: "",
|
|
101
|
+
},
|
|
102
|
+
link_content_meta_id: {
|
|
103
|
+
type: [Number, String],
|
|
104
|
+
default: 0,
|
|
105
|
+
},
|
|
106
|
+
versions: {
|
|
107
|
+
type: Array,
|
|
108
|
+
default: () => [],
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
model: {
|
|
112
|
+
prop: "modelValue",
|
|
113
|
+
event: "update:modelValue",
|
|
114
|
+
},
|
|
115
|
+
emits: ["update:modelValue"],
|
|
116
|
+
data() {
|
|
117
|
+
return {
|
|
118
|
+
loading: false,
|
|
119
|
+
type: "view",
|
|
120
|
+
types: [
|
|
121
|
+
{ label: "可视化", value: "view" },
|
|
122
|
+
{ label: "源码", value: "code" },
|
|
123
|
+
],
|
|
124
|
+
version1: "", // 版本1 默认最新,下拉可指定
|
|
125
|
+
version2: "", // 版本2 默认点击的版本,下拉可指定
|
|
126
|
+
content1: "",
|
|
127
|
+
content2: "",
|
|
128
|
+
};
|
|
129
|
+
},
|
|
130
|
+
computed: {
|
|
131
|
+
content1Len() {
|
|
132
|
+
const content = this.content1 || "";
|
|
133
|
+
return content
|
|
134
|
+
.replace(/(<([^>]+)>)/gi, "")
|
|
135
|
+
.replace(/\n/g, "")
|
|
136
|
+
.replace(/\s/g, "")
|
|
137
|
+
.replaceAll(" ", "").length;
|
|
138
|
+
},
|
|
139
|
+
content2Len() {
|
|
140
|
+
const content = this.content2 || "";
|
|
141
|
+
return content
|
|
142
|
+
.replace(/(<([^>]+)>)/gi, "")
|
|
143
|
+
.replace(/\n/g, "")
|
|
144
|
+
.replace(/\s/g, "")
|
|
145
|
+
.replaceAll(" ", "").length;
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
watch: {
|
|
149
|
+
modelValue: {
|
|
150
|
+
immediate: true,
|
|
151
|
+
handler(val) {
|
|
152
|
+
if (val) {
|
|
153
|
+
this.content1 = this.content;
|
|
154
|
+
console.log(this.content, this.content1);
|
|
155
|
+
this.version2 = this.commit_hash;
|
|
156
|
+
if (this.version2) {
|
|
157
|
+
this.load(this.version2, "content2");
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
methods: {
|
|
164
|
+
close() {
|
|
165
|
+
this.$emit("update:modelValue", false);
|
|
166
|
+
},
|
|
167
|
+
versionChange(val, i) {
|
|
168
|
+
if (val) {
|
|
169
|
+
this[`version${i}`] = val;
|
|
170
|
+
const key = `content${i}`;
|
|
171
|
+
this.load(val, key);
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
load(hash, key) {
|
|
175
|
+
if (!this.link_content_meta_id) return;
|
|
176
|
+
this.loading = true;
|
|
177
|
+
getCommitByHash(this.link_content_meta_id, hash)
|
|
178
|
+
.then((res) => {
|
|
179
|
+
this[key] = res.data?.data?.content;
|
|
180
|
+
})
|
|
181
|
+
.finally(() => {
|
|
182
|
+
this.loading = false;
|
|
183
|
+
});
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
</script>
|
|
188
|
+
|
|
189
|
+
<style lang="less">
|
|
190
|
+
.m-version-contrast-dialog {
|
|
191
|
+
.el-dialog__body {
|
|
192
|
+
padding: 0 20px 20px;
|
|
193
|
+
}
|
|
194
|
+
.m-toolbar {
|
|
195
|
+
display: flex;
|
|
196
|
+
gap: 10px;
|
|
197
|
+
flex-direction: column;
|
|
198
|
+
justify-content: center;
|
|
199
|
+
align-items: center;
|
|
200
|
+
.m-select {
|
|
201
|
+
display: flex;
|
|
202
|
+
gap: 20px;
|
|
203
|
+
width: 100%;
|
|
204
|
+
.u-select {
|
|
205
|
+
flex: 1;
|
|
206
|
+
}
|
|
207
|
+
.el-input--prefix .el-input__inner {
|
|
208
|
+
padding-left: 55px;
|
|
209
|
+
}
|
|
210
|
+
.el-input__prefix {
|
|
211
|
+
left: 10px;
|
|
212
|
+
top: 10px;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
.m-content-container {
|
|
217
|
+
display: flex;
|
|
218
|
+
gap: 20px;
|
|
219
|
+
margin-top: 20px;
|
|
220
|
+
max-height: 520px;
|
|
221
|
+
overflow-x: hidden;
|
|
222
|
+
overflow-y: auto;
|
|
223
|
+
.u-content {
|
|
224
|
+
flex: 1;
|
|
225
|
+
border: 1px solid #ebeef5;
|
|
226
|
+
padding: 20px;
|
|
227
|
+
box-sizing: border-box;
|
|
228
|
+
.r(5px);
|
|
229
|
+
}
|
|
230
|
+
.m-content-view {
|
|
231
|
+
margin: 0;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
</style>
|
|
@@ -181,9 +181,15 @@ export default {
|
|
|
181
181
|
this.other_authors = other_authors;
|
|
182
182
|
},
|
|
183
183
|
toComment() {
|
|
184
|
-
this.$
|
|
185
|
-
|
|
186
|
-
|
|
184
|
+
this.$nextTick(() => {
|
|
185
|
+
const element = this.$refs.commentView;
|
|
186
|
+
if (element) {
|
|
187
|
+
const offsetTop = element.offsetTop + 75;
|
|
188
|
+
window.scrollTo({
|
|
189
|
+
top: offsetTop,
|
|
190
|
+
behavior: "smooth",
|
|
191
|
+
});
|
|
192
|
+
}
|
|
187
193
|
});
|
|
188
194
|
},
|
|
189
195
|
},
|
|
@@ -218,8 +224,8 @@ export default {
|
|
|
218
224
|
}
|
|
219
225
|
location.href = `/community/${val}`;
|
|
220
226
|
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
227
|
+
},
|
|
228
|
+
},
|
|
223
229
|
},
|
|
224
230
|
};
|
|
225
231
|
</script>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<div class="item">
|
|
4
4
|
<fav :postId="postId" :postType="postType" :postTitle="postTitle" :hiddenNum="true" :isOld="true"></fav>
|
|
5
5
|
</div>
|
|
6
|
-
<el-tooltip v-if="showComment" effect="dark" content="去评论" placement="left">
|
|
6
|
+
<el-tooltip v-if="showCommentBtn && showComment" effect="dark" content="去评论" placement="left">
|
|
7
7
|
<div class="u-item" @click="toComment">
|
|
8
8
|
<i class="el-icon-chat-dot-square"></i>
|
|
9
9
|
</div>
|
|
@@ -26,7 +26,7 @@ export default {
|
|
|
26
26
|
return {
|
|
27
27
|
scrollToptimer: null,
|
|
28
28
|
scrollBtnShow: false,
|
|
29
|
-
|
|
29
|
+
showCommentBtn: false, // 等待img等元素加载完毕再显示评论按钮
|
|
30
30
|
|
|
31
31
|
isOpen: true,
|
|
32
32
|
};
|
|
@@ -36,19 +36,10 @@ export default {
|
|
|
36
36
|
},
|
|
37
37
|
methods: {
|
|
38
38
|
goTop() {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var osTop = document.documentElement.scrollTop || document.body.scrollTop;
|
|
44
|
-
var ispeed = Math.floor(-osTop / 7);
|
|
45
|
-
document.documentElement.scrollTop = document.body.scrollTop = osTop + ispeed;
|
|
46
|
-
//到达顶部,清除定时器
|
|
47
|
-
if (osTop === 0) {
|
|
48
|
-
clearInterval(self.scrollToptimer);
|
|
49
|
-
}
|
|
50
|
-
self.isTop = true;
|
|
51
|
-
}, 30);
|
|
39
|
+
window.scrollTo({
|
|
40
|
+
top: 0,
|
|
41
|
+
behavior: "smooth",
|
|
42
|
+
});
|
|
52
43
|
},
|
|
53
44
|
toComment() {
|
|
54
45
|
this.$emit("toComment");
|
|
@@ -66,13 +57,12 @@ export default {
|
|
|
66
57
|
} else {
|
|
67
58
|
self.scrollBtnShow = false;
|
|
68
59
|
}
|
|
69
|
-
//回到顶部过程中用户滚动滚动条,停止定时器
|
|
70
|
-
if (!self.isTop) {
|
|
71
|
-
clearInterval(self.scrollToptimer);
|
|
72
|
-
}
|
|
73
|
-
self.isTop = false;
|
|
74
60
|
});
|
|
75
61
|
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
this.showCommentBtn = true;
|
|
64
|
+
}, 1000);
|
|
65
|
+
|
|
76
66
|
Bus.$on("toggleRightSide", (data) => {
|
|
77
67
|
this.isOpen = data;
|
|
78
68
|
});
|
|
@@ -120,7 +110,7 @@ export default {
|
|
|
120
110
|
font-weight: bold;
|
|
121
111
|
color: #3871e0;
|
|
122
112
|
}
|
|
123
|
-
.w-fav2 svg{
|
|
113
|
+
.w-fav2 svg {
|
|
124
114
|
.size(26px);
|
|
125
115
|
}
|
|
126
116
|
}
|
package/vue.config.js
CHANGED
|
@@ -28,19 +28,19 @@ module.exports = {
|
|
|
28
28
|
proxy: {
|
|
29
29
|
"/api/vip": {
|
|
30
30
|
target: "https://pay.jx3box.com",
|
|
31
|
-
onProxyReq: function(request) {
|
|
31
|
+
onProxyReq: function (request) {
|
|
32
32
|
request.setHeader("origin", "");
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
35
|
"/api/inspire": {
|
|
36
36
|
target: "https://pay.jx3box.com",
|
|
37
|
-
onProxyReq: function(request) {
|
|
37
|
+
onProxyReq: function (request) {
|
|
38
38
|
request.setHeader("origin", "");
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
"/api/team": {
|
|
42
|
-
|
|
43
|
-
onProxyReq: function(request) {
|
|
42
|
+
target: "https://team.api.jx3box.com",
|
|
43
|
+
onProxyReq: function (request) {
|
|
44
44
|
request.setHeader("origin", "");
|
|
45
45
|
},
|
|
46
46
|
},
|
|
@@ -48,9 +48,9 @@ module.exports = {
|
|
|
48
48
|
target: "https://cms.jx3box.com",
|
|
49
49
|
// target: process.env["DEV_SERVER"] == "true" ? "http://localhost:7100" : "https://cms.jx3box.com",
|
|
50
50
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
"/api/article": {
|
|
52
|
+
target: "https://next2.jx3box.com",
|
|
53
|
+
},
|
|
54
54
|
"/api/messages": {
|
|
55
55
|
target: "https://helper.jx3box.com",
|
|
56
56
|
},
|
|
@@ -62,19 +62,25 @@ module.exports = {
|
|
|
62
62
|
},
|
|
63
63
|
"/api/personal": {
|
|
64
64
|
target: "https://pay.jx3box.com",
|
|
65
|
-
onProxyReq: function(request) {
|
|
65
|
+
onProxyReq: function (request) {
|
|
66
66
|
request.setHeader("origin", "");
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
|
-
"/api/cny":{
|
|
69
|
+
"/api/cny": {
|
|
70
70
|
target: "https://pay.jx3box.com",
|
|
71
|
-
onProxyReq: function(request) {
|
|
71
|
+
onProxyReq: function (request) {
|
|
72
|
+
request.setHeader("origin", "");
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
"/api/next2": {
|
|
76
|
+
target: "https://dev.next2.jx3box.com",
|
|
77
|
+
onProxyReq: function (request) {
|
|
72
78
|
request.setHeader("origin", "");
|
|
73
79
|
},
|
|
74
80
|
},
|
|
75
81
|
"/api": {
|
|
76
82
|
target: "https://dev.next2.jx3box.com",
|
|
77
|
-
onProxyReq: function(request) {
|
|
83
|
+
onProxyReq: function (request) {
|
|
78
84
|
request.setHeader("origin", "");
|
|
79
85
|
},
|
|
80
86
|
},
|
|
@@ -102,10 +108,7 @@ module.exports = {
|
|
|
102
108
|
.tap((options) => Object.assign(options, { limit: 10240 }));
|
|
103
109
|
|
|
104
110
|
//💝 in-line svg imgs ~
|
|
105
|
-
config.module
|
|
106
|
-
.rule("vue")
|
|
107
|
-
.use("vue-svg-inline-loader")
|
|
108
|
-
.loader("vue-svg-inline-loader");
|
|
111
|
+
config.module.rule("vue").use("vue-svg-inline-loader").loader("vue-svg-inline-loader");
|
|
109
112
|
|
|
110
113
|
//💖 import common less var * mixin ~
|
|
111
114
|
const types = ["vue-modules", "vue", "normal-modules", "normal"];
|
|
@@ -116,11 +119,9 @@ module.exports = {
|
|
|
116
119
|
// path.resolve(__dirname, './src/assets/css/var.less')
|
|
117
120
|
);
|
|
118
121
|
function addStyleResource(rule) {
|
|
119
|
-
rule.use("style-resource")
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
patterns: preload_styles,
|
|
123
|
-
});
|
|
122
|
+
rule.use("style-resource").loader("style-resources-loader").options({
|
|
123
|
+
patterns: preload_styles,
|
|
124
|
+
});
|
|
124
125
|
}
|
|
125
126
|
types.forEach((type) => addStyleResource(config.module.rule("less").oneOf(type)));
|
|
126
127
|
},
|