@jx3box/jx3box-ui 2.0.5 → 2.0.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.
Files changed (241) hide show
  1. package/.storybook/preview.js +22 -13
  2. package/.storybook/storybookMocks.js +214 -0
  3. package/README.md +39 -43
  4. package/assets/css/bread/admin.less +20 -2
  5. package/assets/css/bread/breadcrumb.less +5 -2
  6. package/assets/css/comment/quick-reply.less +1 -1
  7. package/assets/css/common/left-sidebar.less +1 -1
  8. package/assets/css/interact/like2.less +5 -2
  9. package/assets/css/interact/qrcode.less +69 -0
  10. package/assets/css/single/author.less +15 -10
  11. package/assets/css/single/cms-single.less +1 -0
  12. package/assets/css/single/thx.less +34 -11
  13. package/assets/css/wiki/wiki-comments.less +176 -0
  14. package/assets/css/wiki/wiki-panel.less +177 -0
  15. package/assets/css/wiki/wiki-revisions.less +62 -0
  16. package/assets/data/nav.json +344 -10
  17. package/assets/img/comment/comment.svg +1 -1
  18. package/assets/img/comment/heart_1.svg +1 -1
  19. package/assets/img/comment/hide.svg +1 -1
  20. package/assets/img/leftsidebar/medal.svg +1 -1
  21. package/assets/img/leftsidebar/post.svg +27 -46
  22. package/i18n/messages/en-US.js +357 -22
  23. package/i18n/messages/vi.js +350 -22
  24. package/i18n/messages/zh-CN.js +469 -20
  25. package/i18n/messages/zh-TW.js +350 -22
  26. package/index.js +19 -7
  27. package/package.json +8 -5
  28. package/service/cms.js +22 -0
  29. package/service/commit-history.js +18 -0
  30. package/service/community.js +60 -0
  31. package/service/fav.js +5 -6
  32. package/src/App.vue +210 -80
  33. package/src/Breadcrumb.vue +24 -11
  34. package/src/CommonFooter.vue +2 -2
  35. package/src/Footer.vue +13 -5
  36. package/src/LeftSideToggle.vue +10 -3
  37. package/src/LeftSidebar.vue +19 -5
  38. package/src/Main.vue +9 -2
  39. package/src/RightSidebar.vue +12 -3
  40. package/src/SuspendCommon.vue +52 -38
  41. package/src/author/AuthorFans.vue +7 -5
  42. package/src/author/AuthorFollow.vue +14 -7
  43. package/src/author/AuthorGift.vue +25 -17
  44. package/src/author/AuthorInfo.vue +46 -19
  45. package/src/author/AuthorLink.vue +3 -1
  46. package/src/author/AuthorMedals.vue +5 -2
  47. package/src/author/AuthorPosts.vue +31 -13
  48. package/src/author/AuthorRss.vue +7 -3
  49. package/src/author/AuthorTeams.vue +3 -1
  50. package/src/author/UserPop.vue +29 -17
  51. package/src/bread/Admin.vue +55 -32
  52. package/src/bread/AdminDirectMessage.vue +15 -8
  53. package/src/bread/AdminDrop.vue +124 -45
  54. package/src/bread/CommunityAdmin.vue +527 -0
  55. package/src/bread/DesignTask.vue +30 -26
  56. package/src/bread/ListAdmin.vue +199 -0
  57. package/src/bread/MigrateCommunity.vue +192 -0
  58. package/src/bread/MoveToCommunityDialog.vue +234 -0
  59. package/src/comment/Avatar.vue +18 -24
  60. package/src/comment/CommentContent.vue +57 -37
  61. package/src/comment/CommentContentSimple.vue +61 -63
  62. package/src/comment/CommentInputForm.vue +45 -34
  63. package/src/comment/CommentWithReply.vue +9 -6
  64. package/src/comment/QuickReply.vue +5 -1
  65. package/src/comment/ReplyForReply.vue +6 -4
  66. package/src/comment/ReplyList.vue +28 -18
  67. package/src/comment/Upload.vue +24 -6
  68. package/src/filters/clientBy.vue +10 -8
  69. package/src/filters/markBy.vue +35 -31
  70. package/src/filters/menuBy.vue +20 -22
  71. package/src/filters/orderBy.vue +17 -11
  72. package/src/filters/tagBy.vue +4 -2
  73. package/src/filters/topicBy.vue +12 -10
  74. package/src/filters/versionBy.vue +5 -3
  75. package/src/filters/zlpBy.vue +29 -25
  76. package/src/footer/copyright.vue +5 -5
  77. package/src/footer/links.vue +2 -2
  78. package/src/footer/official.vue +1 -1
  79. package/src/footer/resource.vue +6 -6
  80. package/src/header/alternate.vue +35 -18
  81. package/src/header/asset.vue +9 -19
  82. package/src/header/box.vue +20 -8
  83. package/src/header/box2.vue +16 -9
  84. package/src/header/client.vue +7 -7
  85. package/src/header/lang.vue +41 -6
  86. package/src/header/logo.vue +2 -3
  87. package/src/header/manage.vue +2 -2
  88. package/src/header/message.vue +3 -3
  89. package/src/header/nav.vue +26 -23
  90. package/src/header/publish.vue +2 -2
  91. package/src/header/search.vue +2 -2
  92. package/src/header/shop.vue +2 -2
  93. package/src/header/user.vue +4 -4
  94. package/src/header/userInfo.vue +22 -24
  95. package/src/header/vip.vue +2 -2
  96. package/src/interact/BoxcoinAdmin.vue +30 -16
  97. package/src/interact/BoxcoinRecords.vue +28 -11
  98. package/src/interact/BoxcoinUser.vue +33 -17
  99. package/src/interact/Fav.vue +5 -1
  100. package/src/interact/Homework.vue +317 -0
  101. package/src/interact/Like.vue +4 -2
  102. package/src/interact/QRcode.vue +104 -0
  103. package/src/interact/Rss.vue +10 -4
  104. package/src/interact/Share.vue +18 -19
  105. package/src/interact/WatchLater.vue +5 -1
  106. package/src/main.js +1 -0
  107. package/src/single/Author.vue +5 -1
  108. package/src/single/CmsSingle.vue +29 -15
  109. package/src/single/Collection.vue +36 -26
  110. package/src/single/Comment.vue +19 -13
  111. package/src/single/Creators.vue +5 -3
  112. package/src/single/PostCollection.vue +158 -0
  113. package/src/single/PostDirectory.vue +0 -126
  114. package/src/single/PostGuide.vue +93 -0
  115. package/src/single/PostHeader.vue +39 -17
  116. package/src/single/PostTopic.vue +3 -3
  117. package/src/single/PostVersion.vue +219 -0
  118. package/src/single/RightAffix.vue +160 -0
  119. package/src/single/SimpleThx.vue +4 -2
  120. package/src/single/Thx.vue +14 -2
  121. package/src/single/VersionDialog.vue +238 -0
  122. package/src/stories/components/StoryPropsTable.vue +137 -0
  123. package/src/stories/filters/FilterGallery.stories.js +110 -0
  124. package/src/stories/filters/clientBy.stories.js +24 -0
  125. package/src/stories/filters/markBy.stories.js +6 -0
  126. package/src/stories/filters/menuBy.stories.js +6 -0
  127. package/src/stories/filters/orderBy.stories.js +6 -0
  128. package/src/stories/filters/tagBy.stories.js +6 -0
  129. package/src/stories/filters/topicBy.stories.js +6 -0
  130. package/src/stories/filters/versionBy.stories.js +6 -0
  131. package/src/stories/filters/zlpBy.stories.js +6 -0
  132. package/src/stories/interact/QRcode.stories.js +59 -0
  133. package/src/stories/layout/BaseShell.stories.js +38 -0
  134. package/src/stories/layout/Breadcrumb.stories.js +40 -0
  135. package/src/stories/layout/CommonFooter.stories.js +1 -1
  136. package/src/stories/layout/CommonHeader.stories.js +1 -1
  137. package/src/stories/layout/LeftSideToggle.stories.js +78 -0
  138. package/src/stories/layout/LeftSidebar.stories.js +40 -0
  139. package/src/stories/layout/Main.stories.js +41 -0
  140. package/src/stories/layout/RightSidebar.stories.js +36 -0
  141. package/src/stories/layout/StorybookShell.vue +271 -0
  142. package/src/stories/layout/SuspendCommon.stories.js +67 -0
  143. package/src/stories/layout/SuspendCommonStage.vue +143 -0
  144. package/src/stories/mockData.js +369 -0
  145. package/src/stories/other/UserPop.stories.js +51 -0
  146. package/src/stories/single/Author.stories.js +19 -0
  147. package/src/stories/single/AuthorStoryStage.vue +103 -0
  148. package/src/stories/single/CmsSingle.stories.js +19 -0
  149. package/src/stories/single/CmsSingleStoryStage.vue +118 -0
  150. package/src/stories/single/Collection.stories.js +34 -0
  151. package/src/stories/single/Comment.stories.js +36 -0
  152. package/src/stories/single/Creators.stories.js +34 -0
  153. package/src/stories/single/PostCollection.stories.js +34 -0
  154. package/src/stories/single/PostDirectory.stories.js +31 -0
  155. package/src/stories/single/PostGuide.stories.js +47 -0
  156. package/src/stories/single/PostHeader.stories.js +39 -0
  157. package/src/stories/single/PostVersion.stories.js +41 -0
  158. package/src/stories/single/RightAffix.stories.js +84 -0
  159. package/src/stories/single/SimpleThx.stories.js +39 -0
  160. package/src/stories/single/SingleGallery.stories.js +207 -0
  161. package/src/stories/single/Thx.stories.js +38 -0
  162. package/src/stories/wiki/GamePrice.stories.js +64 -0
  163. package/src/stories/wiki/WikiComments.stories.js +58 -0
  164. package/src/stories/wiki/WikiPanel.stories.js +69 -0
  165. package/src/stories/wiki/WikiRevisions.stories.js +47 -0
  166. package/src/wiki/GamePrice.vue +107 -0
  167. package/src/wiki/WikiComment.vue +153 -0
  168. package/src/wiki/WikiComments.vue +206 -0
  169. package/src/wiki/WikiPanel.vue +121 -0
  170. package/src/wiki/WikiRevisions.vue +125 -0
  171. package/vue.config.js +2 -12
  172. package/assets/css/common/bottom.less +0 -25
  173. package/assets/css/editor/article.less +0 -36
  174. package/assets/css/editor/combo.less +0 -362
  175. package/assets/css/editor/resource.less +0 -399
  176. package/assets/css/editor/tinymce.less +0 -100
  177. package/assets/css/editor/upload.less +0 -136
  178. package/assets/css/module/author.less +0 -231
  179. package/assets/css/module/buff.less +0 -88
  180. package/assets/css/module/directory.less +0 -165
  181. package/assets/css/module/icon.less +0 -25
  182. package/assets/css/module/item.less +0 -279
  183. package/assets/css/module/item_simple.less +0 -58
  184. package/assets/css/module/jx3_element.less +0 -5
  185. package/assets/css/module/macro.less +0 -89
  186. package/assets/css/module/npc.less +0 -265
  187. package/assets/css/module/resource.less +0 -93
  188. package/assets/css/module/skill.less +0 -74
  189. package/assets/css/module/talent.less +0 -495
  190. package/assets/js/a.js +0 -46
  191. package/assets/js/code.js +0 -13
  192. package/assets/js/combo.js +0 -40
  193. package/assets/js/directory.js +0 -114
  194. package/assets/js/filter2.js +0 -186
  195. package/assets/js/fold.js +0 -11
  196. package/assets/js/gallery.js +0 -14
  197. package/assets/js/hljs_languages.js +0 -177
  198. package/assets/js/iframe.js +0 -38
  199. package/assets/js/img.js +0 -23
  200. package/assets/js/item/attribute_percent.js +0 -88
  201. package/assets/js/item/bind.js +0 -18
  202. package/assets/js/item/border.js +0 -19
  203. package/assets/js/item/border_quest.js +0 -12
  204. package/assets/js/item/color.js +0 -25
  205. package/assets/js/item/hljs_languages.js +0 -177
  206. package/assets/js/item/icon_url.js +0 -15
  207. package/assets/js/item/second_format.js +0 -19
  208. package/assets/js/jx3_element.js +0 -73
  209. package/assets/js/katex.js +0 -181
  210. package/assets/js/macro.js +0 -16
  211. package/assets/js/nextpage.js +0 -4
  212. package/assets/js/pswp.js +0 -67
  213. package/assets/js/pswp_template.js +0 -66
  214. package/assets/js/pz_iframe.js +0 -30
  215. package/assets/js/qixue.js +0 -28
  216. package/assets/js/renderImgPreview.js +0 -18
  217. package/assets/js/script.js +0 -6
  218. package/assets/js/stat.js +0 -107
  219. package/assets/js/talent2.js +0 -21
  220. package/assets/js/tex-mml-chtml.js +0 -36310
  221. package/assets/js/voice.js +0 -238
  222. package/assets/js/xss.js +0 -130
  223. package/src/editor/Article.vue +0 -230
  224. package/src/editor/BoxResource.vue +0 -441
  225. package/src/editor/Resource.vue +0 -623
  226. package/src/editor/Tinymce.vue +0 -204
  227. package/src/editor/Upload.vue +0 -277
  228. package/src/editor/UploadAlum.vue +0 -176
  229. package/src/editor/UploadBanner.vue +0 -156
  230. package/src/editor/components/Author.vue +0 -322
  231. package/src/editor/components/Avatar.vue +0 -95
  232. package/src/editor/components/Buff.vue +0 -80
  233. package/src/editor/components/Combo.vue +0 -259
  234. package/src/editor/components/Equip.vue +0 -299
  235. package/src/editor/components/GameText.vue +0 -242
  236. package/src/editor/components/Item.vue +0 -325
  237. package/src/editor/components/ItemSimple.vue +0 -134
  238. package/src/editor/components/Medal.vue +0 -43
  239. package/src/editor/components/Npc.vue +0 -215
  240. package/src/editor/components/PostAuthor.vue +0 -102
  241. package/src/editor/components/Skill.vue +0 -71
@@ -0,0 +1,38 @@
1
+ import Thx from '../../single/Thx.vue';
2
+ import StoryPropsTable from '../components/StoryPropsTable.vue';
3
+
4
+ const meta = {
5
+ title: 'Single/Thx',
6
+ component: Thx,
7
+ parameters: {
8
+ layout: 'fullscreen',
9
+ },
10
+ };
11
+
12
+ export default meta;
13
+
14
+ export const Default = {
15
+ render: () => ({
16
+ components: { Thx, StoryPropsTable },
17
+ setup() {
18
+ return {
19
+ propsInfo: [
20
+ { name: 'postId', type: 'Number | String', default: '0', required: true, description: '文章 ID。' },
21
+ { name: 'postType', type: 'String', default: '""', required: true, description: '文章类型。' },
22
+ { name: 'postTitle', type: 'String', default: '""', description: '文章标题。' },
23
+ { name: 'userId', type: 'Number | String', default: '0', description: '作者 UID。' },
24
+ { name: 'showRss', type: 'Boolean', default: 'false', description: '是否显示订阅按钮。' },
25
+ { name: 'adminBoxcoinEnable / userBoxcoinEnable', type: 'Boolean', default: 'false', description: '控制打赏模块显示。' },
26
+ ],
27
+ };
28
+ },
29
+ template: `
30
+ <div style="display:grid;gap:24px;">
31
+ <section style="border-radius:20px;background:rgba(255,255,255,0.92);padding:24px;box-shadow:0 24px 60px rgba(15,23,42,0.08);">
32
+ <Thx post-type="bbs" post-title="轻剑驭风版本攻略示例" :post-id="80449" :user-id="8" :admin-boxcoin-enable="true" :user-boxcoin-enable="true" :allow-gift="true" :show-rss="true" author-id="8" category="post" />
33
+ </section>
34
+ <StoryPropsTable title="Thx" description="完整互动条组件。" :items="propsInfo" />
35
+ </div>
36
+ `,
37
+ }),
38
+ };
@@ -0,0 +1,64 @@
1
+ import GamePrice from '../../wiki/GamePrice.vue';
2
+ import StoryPropsTable from '../components/StoryPropsTable.vue';
3
+
4
+ const meta = {
5
+ title: 'Wiki/GamePrice',
6
+ component: GamePrice,
7
+ parameters: {
8
+ layout: 'fullscreen',
9
+ },
10
+ argTypes: {
11
+ price: { control: 'text' },
12
+ align: { control: 'boolean' },
13
+ },
14
+ };
15
+
16
+ export default meta;
17
+
18
+ export const Default = {
19
+ args: {
20
+ price: 123456789,
21
+ align: false,
22
+ },
23
+ render: (args) => ({
24
+ components: { GamePrice, StoryPropsTable },
25
+ setup() {
26
+ return {
27
+ args,
28
+ examples: [0, 520, 12888, 123456789, -20800],
29
+ propsInfo: [
30
+ { name: 'price', type: 'Number | String', default: '0', description: '以铜为最小单位的游戏货币值。' },
31
+ { name: 'align', type: 'Boolean', default: 'false', description: '开启后按金额单位宽度对齐。' },
32
+ ],
33
+ };
34
+ },
35
+ template: `
36
+ <div style="display:grid;gap:24px;padding:32px;background:linear-gradient(180deg,#f8fafc 0%,#eef2f7 100%);min-height:100vh;">
37
+ <section style="display:grid;gap:20px;padding:24px;border-radius:20px;background:rgba(255,255,255,0.92);box-shadow:0 24px 60px rgba(15,23,42,0.08);">
38
+ <div>
39
+ <h2 style="margin:0;font-size:28px;color:#0f172a;">GamePrice</h2>
40
+ <p style="margin:12px 0 0;color:#475569;line-height:1.8;">将整型金额拆解为砖金银铜并附带图标展示。</p>
41
+ </div>
42
+ <div style="font-size:28px;color:#0f172a;">
43
+ <GamePrice v-bind="args" />
44
+ </div>
45
+ <div style="display:grid;gap:12px;">
46
+ <div v-for="item in examples" :key="item" style="display:flex;align-items:center;justify-content:space-between;gap:24px;padding:14px 18px;border-radius:14px;background:#f8fafc;">
47
+ <code style="color:#475569;">{{ item }}</code>
48
+ <GamePrice :price="item" :align="args.align" />
49
+ </div>
50
+ </div>
51
+ </section>
52
+ <StoryPropsTable title="GamePrice" description="游戏金额展示组件入参。" :items="propsInfo" />
53
+ </div>
54
+ `,
55
+ }),
56
+ };
57
+
58
+ export const Aligned = {
59
+ args: {
60
+ price: 123456789,
61
+ align: true,
62
+ },
63
+ render: Default.render,
64
+ };
@@ -0,0 +1,58 @@
1
+ import WikiComments from '../../wiki/WikiComments.vue';
2
+ import StorybookShell from '../layout/StorybookShell.vue';
3
+ import StoryPropsTable from '../components/StoryPropsTable.vue';
4
+
5
+ function seedEditorSession() {
6
+ try {
7
+ localStorage.setItem('created_at', String(Date.now()));
8
+ localStorage.setItem('logged_in', 'true');
9
+ localStorage.setItem('group', '64');
10
+ localStorage.setItem('name', 'Storybook编辑者');
11
+ localStorage.setItem('uid', '8');
12
+ localStorage.setItem('avatar', 'https://cdn.jx3box.com/upload/avatar/2022/3/2/8_9860765.png');
13
+ } catch (e) {
14
+ // ignore storage failures in restricted contexts
15
+ }
16
+ }
17
+
18
+ const meta = {
19
+ title: 'Wiki/WikiComments',
20
+ component: WikiComments,
21
+ parameters: {
22
+ layout: 'fullscreen',
23
+ },
24
+ argTypes: {
25
+ type: { control: 'text' },
26
+ sourceId: { control: 'number' },
27
+ },
28
+ };
29
+
30
+ export default meta;
31
+
32
+ export const Default = {
33
+ args: {
34
+ type: 'achievement',
35
+ sourceId: 1001,
36
+ },
37
+ render: (args) => ({
38
+ components: { WikiComments, StorybookShell, StoryPropsTable },
39
+ setup() {
40
+ seedEditorSession();
41
+ return {
42
+ args,
43
+ propsInfo: [
44
+ { name: 'type', type: 'String', default: '""', description: '百科条目类型。' },
45
+ { name: 'sourceId', type: 'Number | String', default: '0', description: '百科条目源 ID。' },
46
+ ],
47
+ };
48
+ },
49
+ template: `
50
+ <StorybookShell placement="main" :show-right-sidebar="false">
51
+ <div style="display:grid;gap:24px;">
52
+ <WikiComments v-bind="args" />
53
+ <StoryPropsTable title="WikiComments" description="百科评论区,已接入 Storybook mock 数据。" :items="propsInfo" />
54
+ </div>
55
+ </StorybookShell>
56
+ `,
57
+ }),
58
+ };
@@ -0,0 +1,69 @@
1
+ import WikiPanel from '../../wiki/WikiPanel.vue';
2
+ import { mockWikiPost } from '../mockData';
3
+ import StorybookShell from '../layout/StorybookShell.vue';
4
+ import StoryPropsTable from '../components/StoryPropsTable.vue';
5
+
6
+ const meta = {
7
+ title: 'Wiki/WikiPanel',
8
+ component: WikiPanel,
9
+ parameters: {
10
+ layout: 'fullscreen',
11
+ },
12
+ };
13
+
14
+ export default meta;
15
+
16
+ export const Default = {
17
+ render: () => ({
18
+ components: { WikiPanel, StorybookShell, StoryPropsTable },
19
+ setup() {
20
+ return {
21
+ mockWikiPost,
22
+ propsInfo: [
23
+ { name: 'wikiPost', type: 'Object', default: 'null', description: '百科详情数据,包含 post/users/source_id/type。' },
24
+ { name: 'scene', type: 'String', default: '"default"', description: '面板所处场景,详情页使用 detail。' },
25
+ { name: 'borderNone', type: 'Boolean', default: 'false', description: '控制外层是否显示边框。' },
26
+ { name: 'showQR', type: 'Boolean', default: 'true', description: '在详情场景中展示二维码入口。' },
27
+ ],
28
+ };
29
+ },
30
+ template: `
31
+ <StorybookShell placement="main" :show-right-sidebar="false">
32
+ <div style="display:grid;gap:24px;">
33
+ <WikiPanel :wiki-post="mockWikiPost" scene="detail">
34
+ <template #head-title>
35
+ <span>百科条目概览</span>
36
+ </template>
37
+ <template #head-actions>
38
+ <el-tag type="success">已发布</el-tag>
39
+ </template>
40
+ <template #body>
41
+ <div style="padding:4px 0 0;line-height:1.9;color:#475569;">
42
+ 这里模拟百科详情页中的信息面板,可同时查看贡献者、热度、更新时间与二维码入口。
43
+ </div>
44
+ </template>
45
+ </WikiPanel>
46
+ <StoryPropsTable title="WikiPanel" description="百科信息面板基础容器。" :items="propsInfo" />
47
+ </div>
48
+ </StorybookShell>
49
+ `,
50
+ }),
51
+ };
52
+
53
+ export const PlainPanel = {
54
+ render: () => ({
55
+ components: { WikiPanel, StorybookShell },
56
+ template: `
57
+ <StorybookShell placement="main" :show-left-sidebar="false" :show-right-sidebar="false">
58
+ <WikiPanel :border-none="true" :show-qr="false">
59
+ <template #head-title>
60
+ <span>普通面板</span>
61
+ </template>
62
+ <template #body>
63
+ <div style="line-height:1.9;color:#475569;">不传 \`wikiPost\` 时可作为通用分区容器使用。</div>
64
+ </template>
65
+ </WikiPanel>
66
+ </StorybookShell>
67
+ `,
68
+ }),
69
+ };
@@ -0,0 +1,47 @@
1
+ import WikiRevisions from '../../wiki/WikiRevisions.vue';
2
+ import StorybookShell from '../layout/StorybookShell.vue';
3
+ import StoryPropsTable from '../components/StoryPropsTable.vue';
4
+
5
+ const meta = {
6
+ title: 'Wiki/WikiRevisions',
7
+ component: WikiRevisions,
8
+ parameters: {
9
+ layout: 'fullscreen',
10
+ },
11
+ argTypes: {
12
+ type: { control: 'text' },
13
+ sourceId: { control: 'number' },
14
+ isGame: { control: 'boolean' },
15
+ },
16
+ };
17
+
18
+ export default meta;
19
+
20
+ export const Default = {
21
+ args: {
22
+ type: 'achievement',
23
+ sourceId: 1001,
24
+ isGame: false,
25
+ },
26
+ render: (args) => ({
27
+ components: { WikiRevisions, StorybookShell, StoryPropsTable },
28
+ setup() {
29
+ return {
30
+ args,
31
+ propsInfo: [
32
+ { name: 'type', type: 'String', default: '""', description: '百科条目类型。' },
33
+ { name: 'sourceId', type: 'Number | String', default: '""', description: '百科条目源 ID。' },
34
+ { name: 'isGame', type: 'Boolean | Number', default: 'false', description: '是否按游戏内链接前缀生成跳转地址。' },
35
+ ],
36
+ };
37
+ },
38
+ template: `
39
+ <StorybookShell placement="main" :show-right-sidebar="false">
40
+ <div style="display:grid;gap:24px;">
41
+ <WikiRevisions v-bind="args" />
42
+ <StoryPropsTable title="WikiRevisions" description="百科历史版本列表。" :items="propsInfo" />
43
+ </div>
44
+ </StorybookShell>
45
+ `,
46
+ }),
47
+ };
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <span class="c-game-price" :class="{ 'is-align': align }">
3
+ <span class="u-neg" v-if="numericPrice < 0">- </span>
4
+ <span v-for="part in priceParts" :key="part.unit" :class="`u-${part.unit}`">
5
+ <span class="u-value">{{ part.value }}</span>
6
+ <img :src="part.icon" :alt="part.alt" />
7
+ </span>
8
+ </span>
9
+ </template>
10
+
11
+ <script>
12
+ import zhuanIcon from "../../assets/img/price/zhuan.png";
13
+ import jinIcon from "../../assets/img/price/jin.png";
14
+ import yinIcon from "../../assets/img/price/yin.png";
15
+ import tongIcon from "../../assets/img/price/tong.png";
16
+
17
+ const PRICE_UNITS = [
18
+ { unit: "zhuan", base: 100000000, icon: zhuanIcon, alt: "砖" },
19
+ { unit: "jin", base: 10000, icon: jinIcon, alt: "金" },
20
+ { unit: "yin", base: 100, icon: yinIcon, alt: "银" },
21
+ { unit: "tong", base: 1, icon: tongIcon, alt: "铜" },
22
+ ];
23
+
24
+ export default {
25
+ name: "GamePrice",
26
+ props: {
27
+ price: {
28
+ type: [Number, String],
29
+ default: 0,
30
+ },
31
+ align: {
32
+ type: Boolean,
33
+ default: false,
34
+ },
35
+ },
36
+ computed: {
37
+ numericPrice() {
38
+ const value = Number(this.price);
39
+ return Number.isFinite(value) ? Math.trunc(value) : 0;
40
+ },
41
+ priceParts() {
42
+ const value = Math.abs(this.numericPrice);
43
+ let remainder = value;
44
+
45
+ const parts = PRICE_UNITS.map((item) => {
46
+ const amount = Math.floor(remainder / item.base);
47
+ remainder %= item.base;
48
+ return {
49
+ ...item,
50
+ value: amount,
51
+ };
52
+ });
53
+
54
+ const visibleParts = parts.filter((item) => item.value > 0);
55
+
56
+ if (!visibleParts.length) {
57
+ const tong = parts.find((item) => item.unit === "tong");
58
+ return tong ? [{ ...tong, value: 0 }] : [];
59
+ }
60
+
61
+ return visibleParts;
62
+ },
63
+ },
64
+ };
65
+ </script>
66
+
67
+ <style lang="less">
68
+ .c-game-price {
69
+ display: inline-flex;
70
+ align-items: center;
71
+ flex-wrap: nowrap;
72
+ white-space: nowrap;
73
+
74
+ .u-neg,
75
+ .u-zhuan,
76
+ .u-jin,
77
+ .u-yin,
78
+ .u-tong {
79
+ display: inline-flex;
80
+ align-items: center;
81
+ flex-shrink: 0;
82
+ }
83
+
84
+ img {
85
+ display: inline-block;
86
+ .y;
87
+ }
88
+
89
+ &.is-align {
90
+ .u-jin {
91
+ .u-value {
92
+ display: inline-block;
93
+ width: 4ch;
94
+ text-align: right;
95
+ }
96
+ }
97
+ .u-yin,
98
+ .u-tong {
99
+ .u-value {
100
+ display: inline-block;
101
+ width: 2ch;
102
+ text-align: right;
103
+ }
104
+ }
105
+ }
106
+ }
107
+ </style>
@@ -0,0 +1,153 @@
1
+ <template>
2
+ <ul class="u-comments">
3
+ <li class="u-comment-panel" v-for="(comment, key) in comments" :key="key">
4
+ <div class="u-comment">
5
+ <!-- 评论内容 -->
6
+ <div class="u-nickname-panel">
7
+ <a
8
+ class="u-nickname"
9
+ :href="comment.user_id ? author_url(comment.user_id) : null"
10
+ target="_blank"
11
+ v-text="comment.user_nickname"
12
+ ></a>
13
+ <template v-if="comment.parent_id">
14
+ <span>&nbsp;回复&nbsp;</span>
15
+ <a
16
+ class="u-nickname"
17
+ :href="comment.parent.user_id ? author_url(comment.parent.user_id) : null"
18
+ target="_blank"
19
+ v-text="comment.parent.user_nickname"
20
+ ></a>
21
+ </template>
22
+ <span class="u-mark u-top" v-if="comment.is_top">
23
+ <i class="el-icon-download"></i>
24
+ 置顶
25
+ </span>
26
+ <span class="u-mark u-star" v-if="comment.is_star">
27
+ <i class="el-icon-star-on"></i>
28
+ 精华
29
+ </span>
30
+ </div>
31
+ <p class="u-content" v-html="comment.content"></p>
32
+ <!-- 其他 -->
33
+ <div class="m-reply">
34
+ <!-- 展开、收起 -->
35
+ <el-button
36
+ type="default"
37
+ v-if="comment.reply_form && comment.reply_form.show"
38
+ class="u-reply"
39
+ @click="comment.reply_form.show = !comment.reply_form.show"
40
+ >
41
+ <i class="el-icon-arrow-up"></i>
42
+ <span>收起</span>
43
+ </el-button>
44
+ <el-button
45
+ type="primary"
46
+ plain
47
+ v-else
48
+ class="u-reply"
49
+ @click="comment.reply_form.show = !comment.reply_form.show"
50
+ icon="ChatDotRound"
51
+ >
52
+ <span>回复</span>
53
+ </el-button>
54
+ <template v-if="isEditor && !comment.parent_id">
55
+ <el-button
56
+ type="primary"
57
+ class="u-reply"
58
+ @click="onStar(comment)"
59
+ plain
60
+ :icon="comment.is_star ? 'StarFilled' : 'Star'"
61
+ >{{ comment.is_star ? "取消加精" : "加精" }}</el-button
62
+ >
63
+ <el-button type="primary" class="u-reply" @click="onTop(comment)" plain icon="Top">{{
64
+ comment.is_top ? "取消置顶" : "置顶"
65
+ }}</el-button>
66
+ </template>
67
+ <!-- 更新时间 -->
68
+ <span class="u-time" v-text="ts2str(comment.updated)"></span>
69
+ </div>
70
+ <!-- 评论回复表单 -->
71
+ <div class="m-reply-form" v-if="comment.reply_form && comment.reply_form.show">
72
+ <textarea class="u-reply-content" v-model="comment.reply_form.content"></textarea>
73
+ <div class="u-author">
74
+ <span>昵称:</span>
75
+ <input v-model="comment.reply_form.user_nickname" type="text" />
76
+ </div>
77
+ <el-button type="primary" class="u-submit" @click="create_comment(comment.reply_form, comment.id)">
78
+ <i class="el-icon-check"></i>
79
+ <span>提交</span>
80
+ </el-button>
81
+ </div>
82
+ </div>
83
+ <WikiComment v-if="comment.children.length" :comments="comment.children" :source-id="sourceId" />
84
+ </li>
85
+ </ul>
86
+ </template>
87
+
88
+ <script>
89
+ import { authorLink, ts2str } from "@jx3box/jx3box-common/js/utils";
90
+ import User from "@jx3box/jx3box-common/js/user";
91
+
92
+ export default {
93
+ name: "WikiComment",
94
+ props: {
95
+ comments: {
96
+ type: Array,
97
+ default: () => [],
98
+ },
99
+ sourceId: {
100
+ type: [Number, String],
101
+ default: 0,
102
+ },
103
+ },
104
+ computed: {
105
+ isEditor() {
106
+ return User.isEditor();
107
+ },
108
+ },
109
+ methods: {
110
+ author_url: authorLink,
111
+ ts2str,
112
+ create_comment(form, parent_id) {
113
+ let app = this.$parent;
114
+ if (!app.create_comment) app = app.$parent;
115
+ if (!app.create_comment) {
116
+ this.$message({
117
+ message: "发布评论异常,请联系管理员",
118
+ type: "warning",
119
+ });
120
+ return;
121
+ }
122
+ app.create_comment(form, parent_id);
123
+ },
124
+ isParent(comment) {
125
+ return !comment.parent_id;
126
+ },
127
+ onStar(comment) {
128
+ let app = this.$parent;
129
+ if (!app.star_comment) app = app.$parent;
130
+ if (!app.star_comment) {
131
+ this.$message({
132
+ message: "操作异常,请联系管理员",
133
+ type: "warning",
134
+ });
135
+ return;
136
+ }
137
+ app.star_comment(comment, comment.is_star ? 0 : 1);
138
+ },
139
+ onTop(comment) {
140
+ let app = this.$parent;
141
+ if (!app.top_comment) app = app.$parent;
142
+ if (!app.top_comment) {
143
+ this.$message({
144
+ message: "操作异常,请联系管理员",
145
+ type: "warning",
146
+ });
147
+ return;
148
+ }
149
+ app.top_comment(comment, comment.is_top ? 0 : 1);
150
+ },
151
+ },
152
+ };
153
+ </script>