@jx3box/jx3box-vue3-ui 0.5.1 → 0.5.2

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.
@@ -1,5 +1,5 @@
1
1
  .m-single-box {
2
- padding: 0 30px;
2
+ // padding: 0 30px;
3
3
  .el-divider__text {
4
4
  color: #888;
5
5
  font-weight: 300;
@@ -29,22 +29,21 @@
29
29
 
30
30
  h1,
31
31
  h2,
32
- h3,h4,h5,h6 {
32
+ h3,
33
+ h4,
34
+ h5,
35
+ h6 {
33
36
  &::before {
34
- content: "\e78b";
35
-
36
- font-family: element-icons !important;
37
- speak: none;
38
- font-style: normal;
39
- font-weight: 400;
40
- font-variant: normal;
41
- text-transform: none;
42
- line-height: 1;
43
- vertical-align: baseline;
37
+ content: "";
38
+ background-image: url("../../img/single/ticket.svg");
44
39
  display: inline-block;
45
- -webkit-font-smoothing: antialiased;
46
40
  margin-right: 5px;
47
- font-size: 16px;
41
+ width: 14px;
42
+ height: 14px;
43
+ display: inline-block;
44
+ background-size: cover;
45
+ position: relative;
46
+ top: 2px;
48
47
  }
49
48
  }
50
49
 
@@ -66,18 +65,17 @@
66
65
  // margin-left: 0;
67
66
  // }
68
67
 
69
- .lv2{
70
- padding-left:20px;
68
+ .lv2 {
69
+ padding-left: 20px;
71
70
  }
72
71
 
73
- .lv3{
74
- padding-left:40px;
72
+ .lv3 {
73
+ padding-left: 40px;
75
74
  }
76
75
 
77
- .lv0{
76
+ .lv0 {
78
77
  display: none;
79
78
  }
80
-
81
79
  }
82
80
 
83
81
  .c-article-directory-title {
@@ -90,7 +88,8 @@
90
88
  // color: #f39;
91
89
  // }
92
90
  }
93
- .c-article-directory-title-skip,.c-article-directory-title-folder{
91
+ .c-article-directory-title-skip,
92
+ .c-article-directory-title-folder {
94
93
  font-size: 14px;
95
94
  float: right;
96
95
  padding: 0 5px;
@@ -102,6 +101,20 @@
102
101
  }
103
102
  }
104
103
  }
104
+ .c-article-directory-title-icon {
105
+ &::before {
106
+ content: "";
107
+ background-image: url("../../img/single/directory-header.svg");
108
+ display: inline-block;
109
+ // margin-right: 5px;
110
+ width: 20px;
111
+ height: 20px;
112
+ display: inline-block;
113
+ background-size: cover;
114
+ position: relative;
115
+ top: 1px;
116
+ }
117
+ }
105
118
  .c-article-directory-content {
106
119
  padding: 10px 15px;
107
120
  }
@@ -119,12 +132,12 @@
119
132
  animation: focusFade 0.5s ease-in-out;
120
133
  }
121
134
 
122
- .w-directory-anchor{
135
+ .w-directory-anchor {
123
136
  .fz(16px);
124
137
  .pointer;
125
138
  // color:@color !important;
126
- &:hover{
127
- box-shadow:none !important;
128
- color:#c00 !important;
139
+ &:hover {
140
+ box-shadow: none !important;
141
+ color: #c00 !important;
129
142
  }
130
- }
143
+ }
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="m64 448 832-320-128 704-446.08-243.328L832 192 242.816 545.472 64 448zm256 512V657.024L512 768 320 960z"></path></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M192 128v768h640V128H192zm-32-64h704a32 32 0 0 1 32 32v832a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32zm160 448h384v64H320v-64zm0-192h192v64H320v-64zm0 384h384v64H320v-64z"></path></svg>
@@ -25,7 +25,7 @@ function directory(from, to = "#directory") {
25
25
  $box.html(
26
26
  `<div class="c-article-directory" id="c-article-directory">
27
27
  <div class="c-article-directory-title" id="c-article-directory-title">
28
- <span class="c-article-directory-title-label" class="c-go-top"><i class="el-icon-s-promotion"></i> 导读</span>
28
+ <span class="c-article-directory-title-label" class="c-go-top"><i class="c-article-directory-title-icon"></i> 导读</span>
29
29
  <span class="c-article-directory-title-skip" class="c-go-top">↑ 顶部</span>
30
30
  <span class="c-article-directory-title-folder" class="c-go-top">↕ 折叠</span>
31
31
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-vue3-ui",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "JX3BOX Vue3 UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/service/cms.js CHANGED
@@ -62,4 +62,8 @@ function getSliders(source_type, source_ids, client='std') {
62
62
  });
63
63
  }
64
64
 
65
- export { getPostAuthors, uploadImage, upload, getDecoration, getDecorationJson, getHonorJson, getSliders, loadAuthors, loadEmotions, uploadFile };
65
+ function getCollection(id) {
66
+ return $cms({ mute: true }).get(`/api/cms/post/collection/${id}`);
67
+ }
68
+
69
+ export { getPostAuthors, uploadImage, upload, getDecoration, getDecorationJson, getHonorJson, getSliders, loadAuthors, loadEmotions, uploadFile, getCollection };
package/src/App.vue CHANGED
@@ -46,7 +46,8 @@
46
46
  <ItemSimple :item="item6" jx3-client-type="2" only-icon="true" iconSize="56px" /> -->
47
47
  <el-divider></el-divider>
48
48
  <UploadAlum />
49
- <PostHeader :post="post"></PostHeader>
49
+ <!-- <PostHeader :post="post"></PostHeader> -->
50
+ <singlebox :post="post" />
50
51
  <SimpleThxVue
51
52
  postType="bbs"
52
53
  postTitle="bbs23865的标题"
@@ -69,6 +70,7 @@
69
70
  <Comment category="post" id="19382"></Comment>
70
71
  <RightSidebar>
71
72
  <PostTopic type="bps" :id="48857"></PostTopic>
73
+ <div id="directory"></div>
72
74
  </RightSidebar>
73
75
 
74
76
  <Footer> </Footer>
@@ -78,12 +80,13 @@
78
80
  </template>
79
81
 
80
82
  <script>
83
+ import singlebox from "./single/cms-single.vue";
81
84
  import UploadAlum from "./editor/UploadAlum.vue";
82
85
  import Author from "./single/Author.vue";
83
86
  import SimpleThxVue from "./single/SimpleThx.vue";
84
87
  import Comment from "./single/Comment.vue";
85
88
  import Thx from "./single/Thx.vue";
86
- import PostHeader from "./single/PostHeader.vue";
89
+ // import PostHeader from "./single/PostHeader.vue";
87
90
  import PostTopic from "./single/PostTopic.vue";
88
91
  import axios from "axios";
89
92
  import post_topics from "@jx3box/jx3box-common/data/post_topics.json";
@@ -97,15 +100,16 @@ export default {
97
100
  Author,
98
101
  Comment,
99
102
  Thx,
100
- PostHeader,
103
+ // PostHeader,
101
104
  PostTopic,
102
105
  UploadAlum,
103
106
  AdminDirectMessage,
107
+ singlebox,
104
108
  // Admin,
105
109
  },
106
110
  data() {
107
111
  return {
108
- post_id: "60031",
112
+ post_id: "69014",
109
113
  post: "",
110
114
  client: location.href.includes("origin") ? "origin" : "std",
111
115
  tag: "",
@@ -0,0 +1,175 @@
1
+ <template>
2
+ <div class="w-collection" v-if="list && list.length">
3
+ <div class="w-collection-title" @click="handleShow" :class="{ on: visible }">
4
+ <span> <el-icon><Notebook /></el-icon> 该作品已被收录至作者的剑三小册 </span>
5
+ <a @click.stop :href="collectionLink(id)" target="_blank">《{{ title }}》</a>
6
+ </div>
7
+ <transition name="fade">
8
+ <div class="w-collection-list" v-if="visible">
9
+ <ol v-if="list && list.length" class="u-list" :style="{ display: visible ? 'block' : 'none' }">
10
+ <li v-for="(item, i) in list" :key="i" class="u-item">
11
+ <a v-if="item" :href="showLink(item)" target="_blank">
12
+ <!-- <i class="el-icon-link"></i> -->
13
+ {{ item.title }}
14
+ </a>
15
+ </li>
16
+ </ol>
17
+ </div>
18
+ </transition>
19
+ </div>
20
+ </template>
21
+
22
+ <script>
23
+ import { getLink } from "@jx3box/jx3box-common/js/utils";
24
+ import { getCollection } from "../../service/cms";
25
+ export default {
26
+ name: "SingleCollection",
27
+ props: ["id", "defaultVisible"],
28
+ inject: [],
29
+ components: {},
30
+ data: function() {
31
+ return {
32
+ visible: this.defaultVisible || false,
33
+ data: {
34
+ title: "",
35
+ posts: [],
36
+ },
37
+ };
38
+ },
39
+ computed: {
40
+ title: function() {
41
+ return this.data?.title;
42
+ },
43
+ list: function() {
44
+ return this.data?.posts;
45
+ },
46
+ },
47
+ watch: {
48
+ id: {
49
+ immediate: true,
50
+ handler: function(val) {
51
+ if (~~val) {
52
+ this.loadData();
53
+ } else {
54
+ this.data = {
55
+ title: "",
56
+ posts: [],
57
+ };
58
+ }
59
+ },
60
+ },
61
+ defaultVisible: function(val) {
62
+ this.visible = val;
63
+ },
64
+ },
65
+ methods: {
66
+ handleShow: function() {
67
+ this.visible = !this.visible;
68
+ },
69
+ loadData: function() {
70
+ getCollection(this.id).then((res) => {
71
+ this.data = res.data?.data;
72
+ this.$emit('collectionUpdate',this.data)
73
+ });
74
+ },
75
+ collectionLink: function(id) {
76
+ return getLink("collection", id);
77
+ },
78
+ showLink: function(item) {
79
+ if (item.type == "custom") {
80
+ return item.url;
81
+ } else {
82
+ return getLink(item.post_type || item.type, item.id);
83
+ }
84
+ },
85
+ },
86
+ created: function() {},
87
+ mounted: function() {},
88
+ };
89
+ </script>
90
+
91
+ <style lang="less">
92
+ .w-collection {
93
+ &-title {
94
+ cursor: pointer;
95
+ position: relative;
96
+ border: 1px solid #ddd;
97
+ background-color: #fafbfc;
98
+ padding: 8px 10px 8px 10px;
99
+ display: block;
100
+ margin-bottom: 0;
101
+ border-radius: 4px;
102
+ line-height: 1.6;
103
+ font-size: 13px;
104
+ letter-spacing: 0.5px;
105
+ i {
106
+ .fz(16px);
107
+ .y(-1px);
108
+ }
109
+
110
+ &::after {
111
+ content: ">";
112
+ display: block;
113
+ position: absolute;
114
+ right: 10px;
115
+ top: 8px;
116
+ font-family: "宋体", Consolas;
117
+ color: #aaa;
118
+ -webkit-transform: rotate(0);
119
+ transform: rotate(0);
120
+ }
121
+
122
+ a {
123
+ .underline(@color-link);
124
+ }
125
+ }
126
+
127
+ counter-reset: collection;
128
+ .u-item {
129
+ .fz(13px, 32px);
130
+ border-bottom: 1px solid #eee;
131
+ transition: 0.15s ease-in-out;
132
+ .nobreak;
133
+ a {
134
+ .db;
135
+ &:before {
136
+ counter-increment: collection;
137
+ content: counter(collection) ". ";
138
+ color: #aaa;
139
+ .mr(5px);
140
+ }
141
+ &:hover {
142
+ background-color: #f0f6fd;
143
+ color: @pink;
144
+ }
145
+ }
146
+ &:last-child {
147
+ border-bottom: none;
148
+ }
149
+ }
150
+
151
+ .u-list {
152
+ padding: 10px 20px;
153
+ margin: 0;
154
+ border: 1px dashed #ddd;
155
+ background: none;
156
+ border-top: none;
157
+ }
158
+
159
+ .on {
160
+ &::after {
161
+ transform: rotate(90deg);
162
+ }
163
+ border-bottom-left-radius: 0;
164
+ border-bottom-right-radius: 0;
165
+ }
166
+
167
+ .fade-enter-active,
168
+ .fade-leave-active {
169
+ transition: opacity 0.5s;
170
+ }
171
+ .fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
172
+ opacity: 0;
173
+ }
174
+ }
175
+ </style>
@@ -0,0 +1,214 @@
1
+ <template>
2
+ <div class="w-creators" v-if="visible">
3
+ <span class="w-creators-title">联合创作</span>
4
+ <a
5
+ class="w-creators-super w-creators-item"
6
+ v-if="super_author"
7
+ :href="authorLink(super_author.ID)"
8
+ target="_blank"
9
+ >
10
+ <img class="u-avatar" :src="showAvatar(super_author.user_avatar)" />
11
+ <span class="u-name">{{ super_author.display_name }}</span>
12
+ <i class="u-up">UP</i>
13
+ </a>
14
+ <div class="w-creators-authors" v-if="other_authors">
15
+ <a
16
+ class="w-creators-author w-creators-item"
17
+ v-for="(item, i) in other_authors"
18
+ :key="i"
19
+ :href="authorLink(item.post_author_info.ID)"
20
+ target="_blank"
21
+ v-show="item.status"
22
+ >
23
+ <img class="u-avatar" :src="showAvatar(item.post_author_info.user_avatar)" />
24
+ <span class="u-name">{{ item.post_author_info.display_name }}</span>
25
+ <i class="u-label">{{ formatLabel(item.label) }}</i>
26
+ </a>
27
+ </div>
28
+ <a class="w-creators-edit" :href="editLink" v-if="isCreator">
29
+ <el-icon><Edit /></el-icon> 编辑当前作品
30
+ </a>
31
+ </div>
32
+ </template>
33
+
34
+ <script>
35
+ import { getPostAuthors } from "../../service/cms";
36
+ import { showAvatar, authorLink, editLink } from "@jx3box/jx3box-common/js/utils";
37
+ import User from "@jx3box/jx3box-common/js/user";
38
+ export default {
39
+ name: "SingleCreators",
40
+ props: ["postId", "postType"],
41
+ components: {},
42
+ data: function () {
43
+ return {
44
+ super_author: "",
45
+ other_authors: "",
46
+ };
47
+ },
48
+ computed: {
49
+ id: function () {
50
+ return this.postId;
51
+ },
52
+ visible: function () {
53
+ return this.other_authors && this.other_authors?.length;
54
+ },
55
+ editLink: function () {
56
+ return editLink(this.postType, this.postId);
57
+ },
58
+ creators: function ({ other_authors }) {
59
+ return other_authors.map((item) => {
60
+ return item.author_id;
61
+ });
62
+ },
63
+ userId: function () {
64
+ return ~~User.getInfo().uid;
65
+ },
66
+ isCreator: function ({ creators, userId, super_author }) {
67
+ return creators.includes(userId) || userId == super_author.ID;
68
+ },
69
+ },
70
+ watch: {
71
+ id: {
72
+ immediate: true,
73
+ handler: function (val) {
74
+ val && this.loadData();
75
+ },
76
+ },
77
+ },
78
+ methods: {
79
+ loadData: function () {
80
+ getPostAuthors(this.id).then((res) => {
81
+ this.super_author = res.data?.data.super_author;
82
+ this.other_authors = res.data?.data.other_authors;
83
+
84
+ const super_author = {
85
+ user_id: this.super_author.ID,
86
+ display_name: this.super_author.display_name,
87
+ user_avatar: this.super_author.user_avatar,
88
+ };
89
+
90
+ const other_authors = this.other_authors?.map((item) => {
91
+ if (item.status) {
92
+ return {
93
+ user_id: item.post_author_info?.ID,
94
+ display_name: item.post_author_info?.display_name,
95
+ user_avatar: item.post_author_info?.user_avatar,
96
+ };
97
+ }
98
+ }).filter((item) => {
99
+ return !!item;
100
+ });
101
+
102
+ // 将联合创作者传出去
103
+ this.$emit("load-authors", { super_author, other_authors });
104
+ });
105
+ },
106
+ showAvatar: function (val) {
107
+ return showAvatar(val, 144);
108
+ },
109
+ authorLink,
110
+ formatLabel: function (str) {
111
+ return str && str.slice(0, 8);
112
+ },
113
+ },
114
+ created: function () {},
115
+ mounted: function () {},
116
+ };
117
+ </script>
118
+
119
+ <style lang="less">
120
+ .w-creators {
121
+ display: flex;
122
+ border: 1px solid #ddd;
123
+ background-color: #fafbfc;
124
+ border-radius: 4px;
125
+ .pr;
126
+ overflow: hidden;
127
+ padding: 15px 10px 15px 40px;
128
+ overflow-x: auto;
129
+ .clearfix;
130
+ }
131
+ .w-creators-title {
132
+ .pa;
133
+ .lt(0);
134
+ writing-mode: vertical-rl;
135
+ .fz(12px);
136
+ background: @primary;
137
+ color: #fff;
138
+ .h(100%);
139
+ .x;
140
+ padding: 0 3px;
141
+ letter-spacing: 1px;
142
+ }
143
+ .w-creators-super {
144
+ // .fl;
145
+ }
146
+ .w-creators-authors {
147
+ // .fl;
148
+ display: flex;
149
+ flex-grow: 1;
150
+ }
151
+ .w-creators-item {
152
+ flex-shrink: 0;
153
+ .pr;
154
+ .u-avatar {
155
+ .size(48px);
156
+ .pa;
157
+ .lt(0);
158
+ .r(4px);
159
+ }
160
+ .pl(58px);
161
+ .mr(20px);
162
+ .u-name {
163
+ .fz(15px);
164
+ .bold;
165
+ .db;
166
+ color: @color;
167
+ margin-bottom: 2px;
168
+ .nobreak;
169
+ max-width: 120px;
170
+ }
171
+ &:hover {
172
+ .u-name {
173
+ color: @color-link;
174
+ }
175
+ }
176
+ .u-up {
177
+ .dbi;
178
+ .fz(12px,1);
179
+ font-style: normal;
180
+ border: 1px solid @pink;
181
+ color: @pink;
182
+ padding: 3px 10px;
183
+ .r(2px);
184
+ .mt(5px);
185
+ }
186
+ .u-label {
187
+ .nobreak;
188
+ max-width: 120px;
189
+ .dbi;
190
+ .fz(12px,1);
191
+ font-style: normal;
192
+ border: 1px solid @color-link;
193
+ color: @color-link;
194
+ padding: 3px 10px;
195
+ .r(2px);
196
+ .mt(5px);
197
+ }
198
+ }
199
+ .w-creators-edit {
200
+ .pa;
201
+ .rb(10px);
202
+ .fz(13px);
203
+ background-color: #e6f0fb;
204
+ padding: 2px 5px;
205
+ &:hover {
206
+ color: @pink;
207
+ }
208
+ }
209
+ @media screen and (max-width: @phone) {
210
+ .w-creators-edit {
211
+ .none;
212
+ }
213
+ }
214
+ </style>
@@ -0,0 +1,147 @@
1
+ <template>
2
+ <div class="m-single-directory"></div>
3
+ </template>
4
+
5
+ <script>
6
+ export default {
7
+ name : 'PostDirectory',
8
+ props:[],
9
+ components : {},
10
+ data : function(){
11
+ return {
12
+
13
+ }
14
+ },
15
+ computed:{},
16
+ watch:{},
17
+ methods:{},
18
+ created:function(){},
19
+ mounted:function(){},
20
+ }
21
+ </script>
22
+
23
+ <style lang="less">
24
+ .c-article-directory {
25
+ h1,
26
+ h2,
27
+ h3,
28
+ h4,
29
+ h5,
30
+ h6 {
31
+ margin: 0;
32
+ padding: 0;
33
+ cursor: pointer;
34
+ font-weight: normal;
35
+ white-space: nowrap;
36
+ word-wrap: normal;
37
+ word-break: keep-all;
38
+ text-overflow: ellipsis;
39
+ overflow: hidden;
40
+ letter-spacing: 0.2px;
41
+ line-height: 20px;
42
+ padding: 8px 0;
43
+ &:hover {
44
+ // font-weight: 600;
45
+ color: #0366d6;
46
+ }
47
+ font-size: 12px;
48
+ }
49
+ a {
50
+ color: @color;
51
+ }
52
+
53
+ h1,
54
+ h2,
55
+ h3,
56
+ h4,
57
+ h5,
58
+ h6 {
59
+ &::before {
60
+ content: "\e78b";
61
+
62
+ font-family: element-icons !important;
63
+ speak: none;
64
+ font-style: normal;
65
+ font-weight: 400;
66
+ font-variant: normal;
67
+ text-transform: none;
68
+ line-height: 1;
69
+ vertical-align: baseline;
70
+ display: inline-block;
71
+ -webkit-font-smoothing: antialiased;
72
+ margin-right: 5px;
73
+ font-size: 16px;
74
+ }
75
+ }
76
+
77
+ // .hasChild {
78
+ // font-size: 14px;
79
+ // &::before {
80
+ // content: "\e784";
81
+ // }
82
+ // }
83
+
84
+ // h2,h3,h4,h5,h6{
85
+ // margin-left: 20px;
86
+ // }
87
+ // .hasChild{
88
+ // margin-left: 0;
89
+ // }
90
+
91
+ // h3 + h2,h4 + h3,h5 + h4,h6 + h5{
92
+ // margin-left: 0;
93
+ // }
94
+
95
+ .lv2 {
96
+ padding-left: 20px;
97
+ }
98
+
99
+ .lv3 {
100
+ padding-left: 40px;
101
+ }
102
+
103
+ .lv0 {
104
+ display: none;
105
+ }
106
+ }
107
+
108
+ .c-article-directory-title {
109
+ margin-bottom: 5px;
110
+ .c-article-directory-title-label {
111
+ font-weight: 300;
112
+ font-size: 20px;
113
+ // cursor: pointer;
114
+ // &:hover {
115
+ // color: #f39;
116
+ // }
117
+ }
118
+ .c-article-directory-title-skip,
119
+ .c-article-directory-title-folder {
120
+ font-size: 14px;
121
+ float: right;
122
+ padding: 0 5px;
123
+ line-height: 25px;
124
+ color: darken(#dcdfe6, 5%);
125
+ cursor: pointer;
126
+ &:hover {
127
+ color: darken(#dcdfe6, 20%);
128
+ }
129
+ }
130
+ }
131
+ .c-article-directory-content {
132
+ padding: 10px 15px;
133
+ }
134
+
135
+ @keyframes focusFade {
136
+ from {
137
+ background-color: #c3fcff;
138
+ }
139
+ to {
140
+ background-color: transparent;
141
+ }
142
+ }
143
+
144
+ .c-article .isScrollFocus {
145
+ animation: focusFade 0.5s ease-in-out;
146
+ }
147
+ </style>
@@ -0,0 +1,213 @@
1
+ <template>
2
+ <div class="m-single-box">
3
+ <!-- 头部 -->
4
+ <PostHeader :post="post" :stat="stat">
5
+ <slot name="single-header"></slot>
6
+ </PostHeader>
7
+
8
+ <!-- 文章前 -->
9
+ <div class="m-single-prepend">
10
+ <!-- 联合创作者 -->
11
+ <Creators class="m-single-creators" :postId="id" :postType="post_type" @load-authors="loadAuthors" />
12
+ <!-- 文集小册 -->
13
+ <Collection
14
+ class="m-single-collection"
15
+ :id="collection_id"
16
+ :defaultVisible="collection_collapse"
17
+ @collectionUpdate="updateCollection"
18
+ />
19
+ <slot name="single-prepend"></slot>
20
+ </div>
21
+
22
+ <!-- 文章内容 -->
23
+ <div class="m-single-post" v-if="visible">
24
+ <el-divider content-position="left">JX3BOX</el-divider>
25
+ <div class="m-single-content">
26
+ <slot></slot>
27
+ <!-- <ArticleMarkdown v-if="isMarkdown" :content="post_content" @directoryRendered="updateDirectory" /> -->
28
+ <Article :content="post_content" @directoryRendered="updateDirectory" />
29
+ </div>
30
+ </div>
31
+ <div class="m-single-null" v-else>
32
+ <el-alert :title="null_tip" type="warning" show-icon></el-alert>
33
+ </div>
34
+
35
+ <!-- 文章后 -->
36
+ <div class="m-single-append">
37
+ <slot name="single-append"></slot>
38
+
39
+ <!-- 打赏 -->
40
+ <Thx
41
+ class="m-single-thx"
42
+ :postId="id"
43
+ :postType="post_type"
44
+ :postTitle="post_title"
45
+ :userId="author_id"
46
+ :adminBoxcoinEnable="true"
47
+ :userBoxcoinEnable="true"
48
+ :authors="authors"
49
+ :client="post_client"
50
+ />
51
+
52
+ <!-- 评论 -->
53
+ <div ref="commentView" class="m-single-comment">
54
+ <el-divider content-position="left">评论</el-divider>
55
+ <Comment :id="id" category="post" v-if="id && allow_comment" />
56
+ <el-alert title="作者没有开启评论功能" type="warning" show-icon v-else></el-alert>
57
+ </div>
58
+ </div>
59
+
60
+ <!-- 底部 -->
61
+ <footer class="m-single-footer">
62
+ <slot name="single-footer"></slot>
63
+ </footer>
64
+
65
+ <!-- <right-affix
66
+ :postId="id"
67
+ :postType="post_type"
68
+ :postTitle="post_title"
69
+ :showComment="id && allow_comment"
70
+ @toComment="toComment($event)"
71
+ ></right-affix> -->
72
+ </div>
73
+ </template>
74
+
75
+ <script>
76
+ import PostHeader from "./PostHeader.vue";
77
+ import Creators from "./Creators.vue";
78
+ import Collection from "./Collection.vue";
79
+ import Thx from "./Thx.vue";
80
+ // import RightAffix from "./right-affix.vue";
81
+ import Article from "../editor/Article.vue";
82
+ // import ArticleMarkdown from "@jx3box/jx3box-editor/src/ArticleMarkdown.vue";
83
+ import Comment from "./Comment.vue";
84
+ import { __visibleMap } from "@jx3box/jx3box-common/data/jx3box.json";
85
+ import { getAppType } from "@jx3box/jx3box-common/js/utils";
86
+ export default {
87
+ name: "cms-single",
88
+ components: {
89
+ PostHeader,
90
+ Creators,
91
+ Collection,
92
+ Thx,
93
+ Article,
94
+ // ArticleMarkdown,
95
+ Comment,
96
+ // RightAffix,
97
+ },
98
+ props: ["post", "stat"],
99
+ data: function () {
100
+ return {
101
+ collection_data: "",
102
+ directory: false,
103
+
104
+ // 创作者
105
+ other_authors: [],
106
+ super_author: "",
107
+ };
108
+ },
109
+ computed: {
110
+ id: function () {
111
+ return ~~this.post?.ID || 0;
112
+ },
113
+ app_type: function () {
114
+ return getAppType();
115
+ },
116
+ post_type: function () {
117
+ return this.post?.post_type;
118
+ },
119
+ post_title: function () {
120
+ return this.post?.post_title;
121
+ },
122
+ author_id: function () {
123
+ return this.post?.post_author;
124
+ },
125
+ collection_id: function () {
126
+ return this.post?.post_collection;
127
+ },
128
+ collection_collapse: function () {
129
+ return this.post?.collection_collapse;
130
+ },
131
+ visible: function () {
132
+ return !!this.post?._check;
133
+ },
134
+ null_tip: function () {
135
+ let str = "作者设置了【";
136
+ str += __visibleMap[this.post?.visible];
137
+ str += "】";
138
+ return str;
139
+ },
140
+ post_content: function () {
141
+ return this.post?.post_content || "";
142
+ },
143
+ post_mode: function () {
144
+ return this.post?.post_mode || "tinymce";
145
+ },
146
+ isMarkdown: function () {
147
+ return this.post_mode == "markdown";
148
+ },
149
+ allow_comment: function () {
150
+ return !this.post?.comment;
151
+ },
152
+ extend_data: function () {
153
+ return {
154
+ collection_data: this.collection_data,
155
+ directory: this.directory,
156
+ };
157
+ },
158
+ authors: function () {
159
+ if (this.other_authors && this.other_authors.length) {
160
+ return [this.super_author, ...this.other_authors];
161
+ }
162
+ return [];
163
+ },
164
+ post_client: function () {
165
+ return this.post?.client || "all";
166
+ },
167
+ },
168
+ methods: {
169
+ updateCollection: function (val) {
170
+ this.collection_data = val;
171
+ },
172
+ updateDirectory: function (val) {
173
+ this.directory = val;
174
+ },
175
+ loadAuthors({ super_author, other_authors }) {
176
+ this.super_author = super_author;
177
+ this.other_authors = other_authors;
178
+ },
179
+ toComment() {
180
+ this.$refs.commentView.scrollIntoView({
181
+ block: "start",
182
+ behavior: "auto",
183
+ });
184
+ },
185
+ },
186
+ watch: {
187
+ extend_data: {
188
+ deep: true,
189
+ immediate: true,
190
+ handler: function (val) {
191
+ this.$emit("extendUpdate", val);
192
+ },
193
+ },
194
+ post_type: {
195
+ deep: true,
196
+ immediate: true,
197
+ handler: function (val) {
198
+ if (location.host.includes("localhost")) {
199
+ return;
200
+ }
201
+
202
+ if (val && val !== this.app_type) {
203
+ location.href = `/${val}/${this.id}`;
204
+ }
205
+ },
206
+ },
207
+ },
208
+ };
209
+ </script>
210
+
211
+ <style lang="less">
212
+ @import "../../assets/css/cms-single.less";
213
+ </style>