@jx3box/jx3box-common-ui 6.4.5 → 6.4.7
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/assets/css/box2.less +111 -0
- package/assets/css/left-sidebar.less +105 -68
- package/assets/data/box2.json +726 -0
- package/package.json +1 -1
- package/src/App.vue +285 -214
- package/src/Box2.vue +122 -0
- package/src/Header.vue +2 -2
- package/src/LeftSidebar.vue +62 -57
- package/src/author/Avatar.vue +37 -2
- package/src/header/user.vue +1 -1
- package/src/interact/Fav2.vue +68 -53
- package/src/single/cms-single.vue +4 -0
- package/src/single/right-affix.vue +106 -0
package/src/LeftSidebar.vue
CHANGED
|
@@ -1,77 +1,82 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
<aside
|
|
3
|
+
class="c-sidebar-left c-sidebar"
|
|
4
|
+
:class="{
|
|
5
5
|
isclose: !isOpen,
|
|
6
6
|
isopen: isOpen,
|
|
7
7
|
'without-bread': withoutBread,
|
|
8
8
|
}"
|
|
9
|
-
|
|
9
|
+
v-if="!isApp"
|
|
10
|
+
>
|
|
11
|
+
<div class="c-sidebar-left-inner">
|
|
12
|
+
<slot></slot>
|
|
13
|
+
</div>
|
|
14
|
+
<span
|
|
15
|
+
class="c-sidebar-left-toggle"
|
|
16
|
+
:class="!isOpen && 'close-sidebar-left'"
|
|
17
|
+
@click="toggleLeftSide"
|
|
18
|
+
:title="isOpen ? '收起侧边栏' : '打开侧边栏'"
|
|
10
19
|
>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
src="../assets/img/leftsidebar/open.svg"
|
|
26
|
-
/>
|
|
27
|
-
</span>
|
|
28
|
-
</aside>
|
|
20
|
+
<!-- <img
|
|
21
|
+
v-show="isOpen"
|
|
22
|
+
svg-inline
|
|
23
|
+
src="../assets/img/leftsidebar/close.svg"
|
|
24
|
+
/> -->
|
|
25
|
+
<span v-show="isOpen"><i class="el-icon-arrow-left"></i></span>
|
|
26
|
+
<span v-show="!isOpen"><i class="el-icon-arrow-right"></i></span>
|
|
27
|
+
<!-- <img
|
|
28
|
+
v-show="!isOpen"
|
|
29
|
+
svg-inline
|
|
30
|
+
src="../assets/img/leftsidebar/open.svg"
|
|
31
|
+
/> -->
|
|
32
|
+
</span>
|
|
33
|
+
</aside>
|
|
29
34
|
</template>
|
|
30
35
|
|
|
31
36
|
<script>
|
|
32
37
|
import Bus from "../service/bus";
|
|
33
38
|
import { isApp } from "../assets/js/app.js";
|
|
34
39
|
export default {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
name: "LeftSidebar",
|
|
41
|
+
props: ["open", "withoutBread"],
|
|
42
|
+
data: function () {
|
|
43
|
+
return {
|
|
44
|
+
isOpen: true,
|
|
45
|
+
isApp: isApp(),
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
computed: {
|
|
49
|
+
stickyHeader: function () {
|
|
50
|
+
return this.withoutBread;
|
|
42
51
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
},
|
|
53
|
+
watch: {
|
|
54
|
+
open: function (newval) {
|
|
55
|
+
this.isOpen = newval === undefined ? true : !!newval;
|
|
47
56
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
},
|
|
58
|
+
methods: {
|
|
59
|
+
toggleLeftSide: function () {
|
|
60
|
+
let status = !this.isOpen;
|
|
61
|
+
Bus.$emit("toggleLeftSide", status);
|
|
52
62
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
mounted: function() {
|
|
60
|
-
Bus.$on("toggleLeftSide", (data) => {
|
|
61
|
-
this.isOpen = data;
|
|
62
|
-
});
|
|
63
|
+
},
|
|
64
|
+
mounted: function () {
|
|
65
|
+
Bus.$on("toggleLeftSide", (data) => {
|
|
66
|
+
this.isOpen = data;
|
|
67
|
+
});
|
|
63
68
|
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
if (window.innerWidth < 1024) {
|
|
70
|
+
this.isOpen = false;
|
|
66
71
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
document.addEventListener("click", function () {
|
|
73
|
+
Bus.$emit("toggleLeftSide", false);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
created: function () {
|
|
78
|
+
this.isOpen = this.open === undefined ? true : this.open;
|
|
79
|
+
},
|
|
75
80
|
};
|
|
76
81
|
</script>
|
|
77
82
|
|
package/src/author/Avatar.vue
CHANGED
|
@@ -36,9 +36,12 @@ export default {
|
|
|
36
36
|
return {
|
|
37
37
|
frames: [],
|
|
38
38
|
styles : {
|
|
39
|
+
xxs : 36,
|
|
40
|
+
xs : 48,
|
|
39
41
|
s : 68,
|
|
40
42
|
m : 88,
|
|
41
|
-
l : 120
|
|
43
|
+
l : 120,
|
|
44
|
+
xl : 150
|
|
42
45
|
}
|
|
43
46
|
};
|
|
44
47
|
},
|
|
@@ -60,7 +63,17 @@ export default {
|
|
|
60
63
|
.c-avatar {
|
|
61
64
|
.pr;
|
|
62
65
|
.dbi;
|
|
63
|
-
|
|
66
|
+
&.xl{
|
|
67
|
+
@pic:150px;
|
|
68
|
+
@frame:210px;
|
|
69
|
+
.c-avatar-pic{.size(@pic);}
|
|
70
|
+
.c-avatar-frame{
|
|
71
|
+
.size(@frame);
|
|
72
|
+
.lt(@pic / 2);
|
|
73
|
+
margin-left:-@frame / 2;
|
|
74
|
+
margin-top:-@frame / 2;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
64
77
|
&.l{
|
|
65
78
|
@pic:120px;
|
|
66
79
|
@frame:168px;
|
|
@@ -96,6 +109,28 @@ export default {
|
|
|
96
109
|
margin-top:-@frame / 2;
|
|
97
110
|
}
|
|
98
111
|
}
|
|
112
|
+
&.xs{
|
|
113
|
+
@pic:48px;
|
|
114
|
+
@frame:68px;
|
|
115
|
+
.c-avatar-pic{.size(@pic);}
|
|
116
|
+
.c-avatar-frame{
|
|
117
|
+
.size(@frame);
|
|
118
|
+
.lt(@pic / 2);
|
|
119
|
+
margin-left:-@frame / 2;
|
|
120
|
+
margin-top:-@frame / 2;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
&.xxs{
|
|
124
|
+
@pic:36px;
|
|
125
|
+
@frame:48px;
|
|
126
|
+
.c-avatar-pic{.size(@pic);}
|
|
127
|
+
.c-avatar-frame{
|
|
128
|
+
.size(@frame);
|
|
129
|
+
.lt(@pic / 2);
|
|
130
|
+
margin-left:-@frame / 2;
|
|
131
|
+
margin-top:-@frame / 2;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
99
134
|
}
|
|
100
135
|
.c-avatar-pic {
|
|
101
136
|
.db;
|
package/src/header/user.vue
CHANGED
package/src/interact/Fav2.vue
CHANGED
|
@@ -1,67 +1,82 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
<div
|
|
3
|
+
class="w-fav2"
|
|
4
|
+
:class="{ disabled: favorite }"
|
|
5
|
+
@click="doFav"
|
|
6
|
+
>
|
|
7
|
+
<el-tooltip
|
|
8
|
+
effect="dark"
|
|
9
|
+
:content="favContent"
|
|
10
|
+
placement="top-start"
|
|
11
|
+
>
|
|
12
|
+
<div>
|
|
13
|
+
<img
|
|
14
|
+
class="u-icon"
|
|
15
|
+
svg-inline
|
|
16
|
+
src="../../assets/img/widget/star.svg"
|
|
17
|
+
/>
|
|
18
|
+
<span
|
|
19
|
+
class="u-count"
|
|
20
|
+
v-if="!hiddenNum && total"
|
|
21
|
+
>{{ total }}</span>
|
|
22
|
+
</div>
|
|
23
|
+
</el-tooltip>
|
|
24
|
+
</div>
|
|
10
25
|
</template>
|
|
11
26
|
|
|
12
27
|
<script>
|
|
13
28
|
import User from "@jx3box/jx3box-common/js/user";
|
|
14
29
|
import { hasFav, addFav, delFav } from "../../service/fav";
|
|
15
30
|
export default {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
name: "Fav2",
|
|
32
|
+
props: ["postType", "postId", "postTitle", "hiddenNum"],
|
|
33
|
+
data: function () {
|
|
34
|
+
return {
|
|
35
|
+
login: User.isLogin(),
|
|
36
|
+
favorite: false,
|
|
37
|
+
total: 0,
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
computed: {
|
|
41
|
+
favContent () {
|
|
42
|
+
return this.favorite ? "取消收藏" : "收藏";
|
|
24
43
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
44
|
+
},
|
|
45
|
+
methods: {
|
|
46
|
+
doFav: function () {
|
|
47
|
+
if (this.login) {
|
|
48
|
+
this.favorite ? this.delFav() : this.addFav();
|
|
49
|
+
} else {
|
|
50
|
+
User.toLogin();
|
|
51
|
+
}
|
|
29
52
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
User.toLogin();
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
hasFav: function () {
|
|
39
|
-
hasFav(this.postType, this.postId).then((res) => {
|
|
40
|
-
this.favorite = res.id || false;
|
|
41
|
-
this.total = res.totalFavorites || 0;
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
addFav: function () {
|
|
45
|
-
addFav(this.postType, this.postId, this.postTitle).then((res) => {
|
|
46
|
-
this.favorite = res.id;
|
|
47
|
-
this.total++;
|
|
48
|
-
});
|
|
49
|
-
},
|
|
50
|
-
delFav: function () {
|
|
51
|
-
delFav(this.favorite).then(() => {
|
|
52
|
-
this.favorite = false;
|
|
53
|
-
this.total && this.total--;
|
|
54
|
-
});
|
|
55
|
-
},
|
|
53
|
+
hasFav: function () {
|
|
54
|
+
hasFav(this.postType, this.postId).then((res) => {
|
|
55
|
+
this.favorite = res.id || false;
|
|
56
|
+
this.total = res.totalFavorites || 0;
|
|
57
|
+
});
|
|
56
58
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
},
|
|
59
|
+
addFav: function () {
|
|
60
|
+
addFav(this.postType, this.postId, this.postTitle).then((res) => {
|
|
61
|
+
this.favorite = res.id;
|
|
62
|
+
this.total++;
|
|
63
|
+
});
|
|
64
64
|
},
|
|
65
|
+
delFav: function () {
|
|
66
|
+
delFav(this.favorite).then(() => {
|
|
67
|
+
this.favorite = false;
|
|
68
|
+
this.total && this.total--;
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
watch: {
|
|
73
|
+
postId: {
|
|
74
|
+
immediate: true,
|
|
75
|
+
handler () {
|
|
76
|
+
if (this.postType && this.postId) this.hasFav();
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
65
80
|
};
|
|
66
81
|
</script>
|
|
67
82
|
|
|
@@ -61,6 +61,8 @@
|
|
|
61
61
|
<footer class="m-single-footer">
|
|
62
62
|
<slot name="single-footer"></slot>
|
|
63
63
|
</footer>
|
|
64
|
+
|
|
65
|
+
<right-affix :postId="id" :postType="post_type" :postTitle="post_title"></right-affix>
|
|
64
66
|
</div>
|
|
65
67
|
</template>
|
|
66
68
|
|
|
@@ -69,6 +71,7 @@ import PostHeader from "./PostHeader.vue";
|
|
|
69
71
|
import Creators from "./Creators.vue";
|
|
70
72
|
import Collection from "./Collection.vue";
|
|
71
73
|
import Thx from "./Thx.vue";
|
|
74
|
+
import RightAffix from "./right-affix.vue";
|
|
72
75
|
import Article from "@jx3box/jx3box-editor/src/Article.vue";
|
|
73
76
|
import ArticleMarkdown from "@jx3box/jx3box-editor/src/ArticleMarkdown.vue";
|
|
74
77
|
import Comment from "@jx3box/jx3box-comment-ui/src/Comment.vue";
|
|
@@ -84,6 +87,7 @@ export default {
|
|
|
84
87
|
Article,
|
|
85
88
|
ArticleMarkdown,
|
|
86
89
|
Comment,
|
|
90
|
+
RightAffix,
|
|
87
91
|
},
|
|
88
92
|
props: ["post", "stat"],
|
|
89
93
|
data: function () {
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="right-affix">
|
|
3
|
+
<div class="item">
|
|
4
|
+
<fav :postId="postId" :postType="postType" :postTitle="postTitle" :hiddenNum="true"></fav>
|
|
5
|
+
</div>
|
|
6
|
+
<el-tooltip effect="dark" content="回到顶部" placement="bottom">
|
|
7
|
+
<div class="item" v-show="scrollBtnShow" @click="goTop">
|
|
8
|
+
<div class="to-top"></div>
|
|
9
|
+
</div>
|
|
10
|
+
</el-tooltip>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
import Fav from "../interact/Fav2.vue";
|
|
16
|
+
export default {
|
|
17
|
+
name: "RightAffix",
|
|
18
|
+
props: ["postId", "postType", "postTitle"],
|
|
19
|
+
data() {
|
|
20
|
+
return {
|
|
21
|
+
scrollToptimer: null,
|
|
22
|
+
scrollBtnShow: false,
|
|
23
|
+
isTop: true,
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
components: {
|
|
27
|
+
Fav,
|
|
28
|
+
},
|
|
29
|
+
methods: {
|
|
30
|
+
goTop() {
|
|
31
|
+
//设置定时器
|
|
32
|
+
const self = this;
|
|
33
|
+
this.scrollToptimer = setInterval(function () {
|
|
34
|
+
//获取滚动条距离顶部高度
|
|
35
|
+
var osTop = document.documentElement.scrollTop || document.body.scrollTop;
|
|
36
|
+
var ispeed = Math.floor(-osTop / 7);
|
|
37
|
+
document.documentElement.scrollTop = document.body.scrollTop = osTop + ispeed;
|
|
38
|
+
//到达顶部,清除定时器
|
|
39
|
+
if (osTop === 0) {
|
|
40
|
+
clearInterval(self.scrollToptimer);
|
|
41
|
+
}
|
|
42
|
+
self.isTop = true;
|
|
43
|
+
}, 30);
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
mounted() {
|
|
47
|
+
//获取页面可视区高度
|
|
48
|
+
var clientHeight = document.documentElement.clientHeight;
|
|
49
|
+
const self = this;
|
|
50
|
+
window.addEventListener("scroll", function () {
|
|
51
|
+
//显示回到顶部按钮
|
|
52
|
+
var osTop = document.documentElement.scrollTop || document.body.scrollTop;
|
|
53
|
+
if (osTop >= clientHeight) {
|
|
54
|
+
self.scrollBtnShow = true;
|
|
55
|
+
} else {
|
|
56
|
+
self.scrollBtnShow = false;
|
|
57
|
+
}
|
|
58
|
+
//回到顶部过程中用户滚动滚动条,停止定时器
|
|
59
|
+
if (!self.isTop) {
|
|
60
|
+
clearInterval(self.scrollToptimer);
|
|
61
|
+
}
|
|
62
|
+
self.isTop = false;
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<style lang="less">
|
|
69
|
+
.right-affix {
|
|
70
|
+
position: fixed;
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
align-items: center;
|
|
75
|
+
right: @aside-right;
|
|
76
|
+
top: @header-height + @bread-height + 100px;
|
|
77
|
+
background-color: #fafbfc;
|
|
78
|
+
padding: 8px 5px;
|
|
79
|
+
z-index: 200;
|
|
80
|
+
border-top-left-radius: 6px;
|
|
81
|
+
border-bottom-left-radius: 6px;
|
|
82
|
+
.item {
|
|
83
|
+
display: flex;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
align-items: center;
|
|
86
|
+
width: 32px;
|
|
87
|
+
height: 32px;
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
&:hover {
|
|
90
|
+
background-color: #f6fcff;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
.to-top {
|
|
94
|
+
width: 0;
|
|
95
|
+
height: 0;
|
|
96
|
+
border-left: 12px solid transparent;
|
|
97
|
+
border-right: 12px solid transparent;
|
|
98
|
+
border-bottom: 18px solid skyblue;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
@media screen and (max-width:@smallpc){
|
|
102
|
+
.right-affix{
|
|
103
|
+
right:0;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
</style>
|