@jx3box/jx3box-vue3-ui 0.0.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.
Files changed (284) hide show
  1. package/.editorconfig +13 -0
  2. package/.env +1 -0
  3. package/.eslintrc +9 -0
  4. package/.prettierrc +21 -0
  5. package/README.md +1 -0
  6. package/assets/css/admin.less +83 -0
  7. package/assets/css/author.less +86 -0
  8. package/assets/css/bottom.less +21 -0
  9. package/assets/css/box.less +180 -0
  10. package/assets/css/box2.less +150 -0
  11. package/assets/css/breadcrumb.less +155 -0
  12. package/assets/css/client-by.less +33 -0
  13. package/assets/css/cms-single.less +55 -0
  14. package/assets/css/crumb.less +17 -0
  15. package/assets/css/down.less +16 -0
  16. package/assets/css/footer.less +72 -0
  17. package/assets/css/github-repo.less +87 -0
  18. package/assets/css/header.less +532 -0
  19. package/assets/css/icon.less +10 -0
  20. package/assets/css/left-sidebar.less +137 -0
  21. package/assets/css/like.less +80 -0
  22. package/assets/css/like2.less +19 -0
  23. package/assets/css/main.less +67 -0
  24. package/assets/css/mark-by.less +97 -0
  25. package/assets/css/mark.less +34 -0
  26. package/assets/css/menu-by.less +9 -0
  27. package/assets/css/mixin.less +62 -0
  28. package/assets/css/order-by.less +86 -0
  29. package/assets/css/print.less +26 -0
  30. package/assets/css/qrcode.less +70 -0
  31. package/assets/css/right-msg.less +26 -0
  32. package/assets/css/right-sidebar.less +106 -0
  33. package/assets/css/share2.less +99 -0
  34. package/assets/css/sharing.less +26 -0
  35. package/assets/css/tag-by.less +86 -0
  36. package/assets/css/thx.less +213 -0
  37. package/assets/css/var.less +4 -0
  38. package/assets/css/wiki-comments.less +150 -0
  39. package/assets/css/wiki-panel.less +175 -0
  40. package/assets/css/wiki-revisions.less +62 -0
  41. package/assets/data/box.json +184 -0
  42. package/assets/data/box2.json +606 -0
  43. package/assets/data/game_font.json +242 -0
  44. package/assets/data/nav.json +12 -0
  45. package/assets/data/panel.json +27 -0
  46. package/assets/data/zlp.json +5 -0
  47. package/assets/img/author/bilibili.png +0 -0
  48. package/assets/img/author/bilibili.svg +1 -0
  49. package/assets/img/author/chat.png +0 -0
  50. package/assets/img/author/douyu.png +0 -0
  51. package/assets/img/author/douyu.svg +1 -0
  52. package/assets/img/author/github.svg +1 -0
  53. package/assets/img/author/huya.png +0 -0
  54. package/assets/img/author/huya.svg +1 -0
  55. package/assets/img/author/msg.svg +55 -0
  56. package/assets/img/author/tuilan.png +0 -0
  57. package/assets/img/author/weibo.svg +70 -0
  58. package/assets/img/bread/menu.svg +1 -0
  59. package/assets/img/footer/china.svg +1 -0
  60. package/assets/img/header/add.svg +1 -0
  61. package/assets/img/header/bell.svg +1 -0
  62. package/assets/img/header/coin.svg +15 -0
  63. package/assets/img/header/edit.svg +1 -0
  64. package/assets/img/header/logo.svg +5 -0
  65. package/assets/img/header/manage.svg +1 -0
  66. package/assets/img/header/msg.svg +1 -0
  67. package/assets/img/header/search-key-slash.svg +5 -0
  68. package/assets/img/header/send.svg +56 -0
  69. package/assets/img/header/vip.svg +1 -0
  70. package/assets/img/jx3.svg +11 -0
  71. package/assets/img/leftsidebar/arrow.svg +64 -0
  72. package/assets/img/leftsidebar/close.svg +49 -0
  73. package/assets/img/leftsidebar/fans.svg +1 -0
  74. package/assets/img/leftsidebar/medal.svg +1 -0
  75. package/assets/img/leftsidebar/more.svg +50 -0
  76. package/assets/img/leftsidebar/open.svg +51 -0
  77. package/assets/img/leftsidebar/post.svg +46 -0
  78. package/assets/img/leftsidebar/team.svg +1 -0
  79. package/assets/img/leftsidebar/united.svg +1 -0
  80. package/assets/img/list/post.svg +1 -0
  81. package/assets/img/price/jin.png +0 -0
  82. package/assets/img/price/tong.png +0 -0
  83. package/assets/img/price/yin.png +0 -0
  84. package/assets/img/price/zhuan.png +0 -0
  85. package/assets/img/rightsidebar/ac.svg +1 -0
  86. package/assets/img/rightsidebar/github.svg +1 -0
  87. package/assets/img/rightsidebar/repo.svg +1 -0
  88. package/assets/img/single/author.svg +1 -0
  89. package/assets/img/single/lock.svg +1 -0
  90. package/assets/img/single/modate.svg +24 -0
  91. package/assets/img/single/podate.svg +23 -0
  92. package/assets/img/widget/admin_gift.svg +10 -0
  93. package/assets/img/widget/gift.svg +1 -0
  94. package/assets/img/widget/heart.svg +17 -0
  95. package/assets/img/widget/heart1.svg +1 -0
  96. package/assets/img/widget/heart2.svg +11 -0
  97. package/assets/img/widget/heart3.svg +37 -0
  98. package/assets/img/widget/like.svg +1 -0
  99. package/assets/img/widget/like2.svg +1 -0
  100. package/assets/img/widget/like3.svg +14 -0
  101. package/assets/img/widget/qq.svg +1 -0
  102. package/assets/img/widget/qr-code.svg +1 -0
  103. package/assets/img/widget/qzone.svg +1 -0
  104. package/assets/img/widget/share-link.png +0 -0
  105. package/assets/img/widget/share.svg +13 -0
  106. package/assets/img/widget/share2.svg +19 -0
  107. package/assets/img/widget/star.svg +9 -0
  108. package/assets/img/widget/tieba.svg +1 -0
  109. package/assets/img/widget/unstar.svg +21 -0
  110. package/assets/img/widget/web_heart_animation.png +0 -0
  111. package/assets/img/widget/weibo.svg +1 -0
  112. package/assets/img/widget/weixin.svg +1 -0
  113. package/assets/js/app.js +7 -0
  114. package/babel.config.js +3 -0
  115. package/jsconfig.json +17 -0
  116. package/package.json +71 -0
  117. package/public/favicon.ico +0 -0
  118. package/public/image/box/bbs.svg +87 -0
  119. package/public/image/box/bbs__.svg +101 -0
  120. package/public/image/box/bbs_on.svg +88 -0
  121. package/public/image/box/bps.svg +10 -0
  122. package/public/image/box/bps_on.svg +10 -0
  123. package/public/image/box/cj.svg +1 -0
  124. package/public/image/box/cj_on.svg +1 -0
  125. package/public/image/box/collection.svg +1 -0
  126. package/public/image/box/collection_on.svg +1 -0
  127. package/public/image/box/database.svg +22 -0
  128. package/public/image/box/database_on.svg +22 -0
  129. package/public/image/box/dbm.svg +21 -0
  130. package/public/image/box/dbm_on.svg +21 -0
  131. package/public/image/box/exam.svg +35 -0
  132. package/public/image/box/exam_on.svg +35 -0
  133. package/public/image/box/facedata.svg +21 -0
  134. package/public/image/box/facedata_on.svg +21 -0
  135. package/public/image/box/fb.svg +18 -0
  136. package/public/image/box/fb_on.svg +18 -0
  137. package/public/image/box/fbdata.svg +15 -0
  138. package/public/image/box/fbdata_on.svg +15 -0
  139. package/public/image/box/fbdrop.svg +26 -0
  140. package/public/image/box/fbdrop_on.svg +26 -0
  141. package/public/image/box/fbgem.svg +39 -0
  142. package/public/image/box/fbgem_on.svg +39 -0
  143. package/public/image/box/flower.svg +28 -0
  144. package/public/image/box/flower_on.svg +28 -0
  145. package/public/image/box/furniture.svg +32 -0
  146. package/public/image/box/furniture_on.svg +32 -0
  147. package/public/image/box/haste.svg +8 -0
  148. package/public/image/box/haste_on.svg +8 -0
  149. package/public/image/box/home.svg +47 -0
  150. package/public/image/box/home_on.svg +47 -0
  151. package/public/image/box/house.svg +1 -0
  152. package/public/image/box/house_on.svg +1 -0
  153. package/public/image/box/icons.svg +15 -0
  154. package/public/image/box/icons_on.svg +15 -0
  155. package/public/image/box/item.svg +1 -0
  156. package/public/image/box/item_on.svg +1 -0
  157. package/public/image/box/j3dps.svg +28 -0
  158. package/public/image/box/j3dps_on.svg +28 -0
  159. package/public/image/box/j3pz.svg +36 -0
  160. package/public/image/box/j3pz_on.svg +36 -0
  161. package/public/image/box/jx3dat.svg +27 -0
  162. package/public/image/box/jx3dat_on.svg +27 -0
  163. package/public/image/box/keju.svg +30 -0
  164. package/public/image/box/keju_on.svg +30 -0
  165. package/public/image/box/knowledge.svg +52 -0
  166. package/public/image/box/knowledge_on.svg +52 -0
  167. package/public/image/box/macro.svg +15 -0
  168. package/public/image/box/macro_on.svg +18 -0
  169. package/public/image/box/macroeditor.svg +38 -0
  170. package/public/image/box/macroeditor_on.svg +38 -0
  171. package/public/image/box/png/100.png +0 -0
  172. package/public/image/box/png/bbs.png +0 -0
  173. package/public/image/box/png/bbs1.png +0 -0
  174. package/public/image/box/png/bbs2.png +0 -0
  175. package/public/image/box/png/bps.png +0 -0
  176. package/public/image/box/png/cj.png +0 -0
  177. package/public/image/box/png/database.png +0 -0
  178. package/public/image/box/png/drop.png +0 -0
  179. package/public/image/box/png/emotion.png +0 -0
  180. package/public/image/box/png/face.png +0 -0
  181. package/public/image/box/png/fb.png +0 -0
  182. package/public/image/box/png/flog.png +0 -0
  183. package/public/image/box/png/flower.png +0 -0
  184. package/public/image/box/png/furniture.png +0 -0
  185. package/public/image/box/png/gem.png +0 -0
  186. package/public/image/box/png/guishi.png +0 -0
  187. package/public/image/box/png/home.png +0 -0
  188. package/public/image/box/png/house.png +0 -0
  189. package/public/image/box/png/icons.png +0 -0
  190. package/public/image/box/png/item.png +0 -0
  191. package/public/image/box/png/j3pz.png +0 -0
  192. package/public/image/box/png/joker.png +0 -0
  193. package/public/image/box/png/jx3dat.png +0 -0
  194. package/public/image/box/png/jx3datbuilder.png +0 -0
  195. package/public/image/box/png/keju.png +0 -0
  196. package/public/image/box/png/macro.png +0 -0
  197. package/public/image/box/png/macroeditor.png +0 -0
  198. package/public/image/box/png/macroeditor2.png +0 -0
  199. package/public/image/box/png/minami.png +0 -0
  200. package/public/image/box/png/mirror.png +0 -0
  201. package/public/image/box/png/oa.png +0 -0
  202. package/public/image/box/png/pig.png +0 -0
  203. package/public/image/box/png/price.png +0 -0
  204. package/public/image/box/png/qiyu.png +0 -0
  205. package/public/image/box/png/rank2_on.png +0 -0
  206. package/public/image/box/png/role.png +0 -0
  207. package/public/image/box/png/servers.png +0 -0
  208. package/public/image/box/png/share.png +0 -0
  209. package/public/image/box/png/shop.png +0 -0
  210. package/public/image/box/png/skull.png +0 -0
  211. package/public/image/box/png/speed.png +0 -0
  212. package/public/image/box/png/talent.png +0 -0
  213. package/public/image/box/png/team.png +0 -0
  214. package/public/image/box/png/team_on.png +0 -0
  215. package/public/image/box/png/tool.png +0 -0
  216. package/public/image/box/png/translator.png +0 -0
  217. package/public/image/box/png/trophy.png +0 -0
  218. package/public/image/box/png/trophy2.png +0 -0
  219. package/public/image/box/png/wiki.png +0 -0
  220. package/public/image/box/price.svg +19 -0
  221. package/public/image/box/price_on.svg +19 -0
  222. package/public/image/box/qiyu.svg +1 -0
  223. package/public/image/box/qiyu_on.svg +1 -0
  224. package/public/image/box/quest.svg +52 -0
  225. package/public/image/box/quest_on.svg +57 -0
  226. package/public/image/box/rank.svg +36 -0
  227. package/public/image/box/rank_on.svg +36 -0
  228. package/public/image/box/servers.svg +31 -0
  229. package/public/image/box/servers_on.svg +31 -0
  230. package/public/image/box/share.svg +24 -0
  231. package/public/image/box/share_on.svg +24 -0
  232. package/public/image/box/shop.svg +52 -0
  233. package/public/image/box/talent.svg +19 -0
  234. package/public/image/box/talent_on.svg +19 -0
  235. package/public/image/box/team.svg +15 -0
  236. package/public/image/box/team_on.svg +18 -0
  237. package/public/image/box/tool.svg +23 -0
  238. package/public/image/box/tool_on.svg +31 -0
  239. package/public/image/box/translator.svg +55 -0
  240. package/public/image/box/translator_on.svg +55 -0
  241. package/public/image/box/wbl.png +0 -0
  242. package/public/image/box/wbl_on.png +0 -0
  243. package/public/image/box/xls.svg +74 -0
  244. package/public/image/box/xls_on.svg +74 -0
  245. package/public/index.html +24 -0
  246. package/service/admin.js +15 -0
  247. package/service/author.js +79 -0
  248. package/service/breadcrumb.js +13 -0
  249. package/service/cms.js +35 -0
  250. package/service/fav.js +17 -0
  251. package/service/follow.js +55 -0
  252. package/service/github.js +15 -0
  253. package/service/header.js +31 -0
  254. package/service/helper.js +7 -0
  255. package/service/thx.js +60 -0
  256. package/src/App.vue +52 -0
  257. package/src/Bottom.vue +23 -0
  258. package/src/Box.vue +149 -0
  259. package/src/Breadcrumb.vue +118 -0
  260. package/src/Footer.vue +45 -0
  261. package/src/Header.vue +95 -0
  262. package/src/LeftSideToggle.vue +64 -0
  263. package/src/LeftSidebar.vue +123 -0
  264. package/src/Main.vue +48 -0
  265. package/src/RightSidebar.vue +25 -0
  266. package/src/bread/Admin.vue +308 -0
  267. package/src/bread/AdminButton.vue +31 -0
  268. package/src/bread/Crumb.vue +27 -0
  269. package/src/header/Asset.vue +180 -0
  270. package/src/header/ClientSwitch.vue +115 -0
  271. package/src/header/GameSwitch.vue +210 -0
  272. package/src/header/Logo.vue +82 -0
  273. package/src/header/Manage.vue +125 -0
  274. package/src/header/Message.vue +89 -0
  275. package/src/header/Nav.vue +287 -0
  276. package/src/header/Publish.vue +21 -0
  277. package/src/header/Search.vue +81 -0
  278. package/src/header/User.vue +141 -0
  279. package/src/header/UserInfo.vue +175 -0
  280. package/src/header/Vip.vue +27 -0
  281. package/src/main.js +30 -0
  282. package/utils/bus.js +5 -0
  283. package/utils/index.js +31 -0
  284. package/vue.config.js +103 -0
package/src/Header.vue ADDED
@@ -0,0 +1,95 @@
1
+ <template>
2
+ <header class="c-header" id="c-header" :class="{ isOverlay: overlayEnable && isOverlay }" v-if="!isApp">
3
+ <div class="c-header-inner">
4
+ <!-- logo -->
5
+ <header-logo />
6
+
7
+ <!-- origin -->
8
+ <clientSwitch :defaultValue="client" />
9
+
10
+ <!-- game -->
11
+ <!-- <gameSwitch /> -->
12
+
13
+ <!-- search -->
14
+ <header-search :client="client" />
15
+
16
+ <!-- nav -->
17
+ <header-nav :client="client" />
18
+
19
+ <slot></slot>
20
+
21
+ <!-- user -->
22
+ <header-user :client="client" />
23
+ </div>
24
+ <Box class="c-header-jx3box" :overlayEnable="overlayEnable" :client="client" />
25
+ </header>
26
+ </template>
27
+
28
+ <script>
29
+ import _ from "lodash";
30
+ import { isApp, KW } from "../assets/js/app.js";
31
+
32
+ // components
33
+ import logo from "./header/Logo.vue";
34
+ import clientSwitch from "./header/ClientSwitch.vue";
35
+ import search from "./header/Search.vue";
36
+ import nav from "./header/Nav.vue";
37
+ import user from "./header/User.vue";
38
+ import Box from "../src/Box.vue";
39
+
40
+ export default {
41
+ name: "CommonHeader",
42
+ props: ["overlayEnable"],
43
+ data: function () {
44
+ return {
45
+ isOverlay: false,
46
+ isApp: isApp(),
47
+ };
48
+ },
49
+ computed: {
50
+ client: function () {
51
+ return location.hostname.includes("origin") ? "origin" : "std";
52
+ },
53
+ },
54
+ methods: {
55
+ // webView检测
56
+ checkIsWebView: function () {
57
+ if (window.navigator.userAgent.includes(KW)) {
58
+ document.documentElement.classList.add("env-app");
59
+ }
60
+ },
61
+
62
+ // 检查
63
+ init: function () {
64
+ this.checkIsWebView();
65
+ },
66
+ },
67
+ created: function () {
68
+ this.init();
69
+
70
+ if (this.overlayEnable) {
71
+ const vm = this;
72
+ window.addEventListener(
73
+ "scroll",
74
+ _.throttle(() => {
75
+ vm.isOverlay = window.scrollY > 200 ? true : false;
76
+ }, 200)
77
+ );
78
+ }
79
+ },
80
+ mounted: function () {},
81
+ components: {
82
+ "header-logo": logo,
83
+ "header-search": search,
84
+ "header-nav": nav,
85
+ "header-user": user,
86
+ Box,
87
+ clientSwitch,
88
+ // gameSwitch,
89
+ },
90
+ };
91
+ </script>
92
+
93
+ <style lang="less">
94
+ @import "../assets/css/header.less";
95
+ </style>
@@ -0,0 +1,64 @@
1
+ <template>
2
+ <div class="c-side-toggle" @click.stop="toggleLeftSide" :class="{ mobileOnly: isMobileOnly, on: isOpen }">
3
+ <img class="u-toggle" svg-inline src="../assets/img/bread/menu.svg" />
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ import Bus from "../utils/bus";
9
+ export default {
10
+ name: "LeftSideToggle",
11
+ props: ["mobileOnly"],
12
+ data: function () {
13
+ return {
14
+ isOpen: true,
15
+ };
16
+ },
17
+ computed: {
18
+ isMobileOnly: function () {
19
+ return this.mobileOnly;
20
+ },
21
+ },
22
+ methods: {
23
+ toggleLeftSide: function () {
24
+ let status = !this.isOpen;
25
+ Bus.emit("toggleLeftSide", status);
26
+ },
27
+ },
28
+ mounted: function () {
29
+ Bus.on("toggleLeftSide", (data) => {
30
+ this.isOpen = data;
31
+ });
32
+
33
+ if (window.innerWidth < 1024) {
34
+ this.isOpen = false;
35
+ }
36
+ },
37
+ components: {},
38
+ };
39
+ </script>
40
+
41
+ <style lang="less">
42
+ .c-side-toggle {
43
+ .pointer;
44
+ .size(20px, 28px);
45
+ padding: 0 5px;
46
+ .u-toggle {
47
+ .h(29px);
48
+ fill: @color;
49
+ }
50
+ &.mobileOnly {
51
+ .none;
52
+ }
53
+ &.on {
54
+ svg {
55
+ fill: @primary;
56
+ }
57
+ }
58
+ }
59
+ @media screen and (max-width: @ipad) {
60
+ .c-side-toggle {
61
+ .db !important;
62
+ }
63
+ }
64
+ </style>
@@ -0,0 +1,123 @@
1
+ <template>
2
+ <aside
3
+ class="c-sidebar-left c-sidebar m-theme"
4
+ :class="{
5
+ isclose: !isOpen,
6
+ isopen: isOpen,
7
+ 'without-bread': withoutBread,
8
+ }"
9
+ v-if="!isApp"
10
+ :style="{ backgroundImage: `url(${bg})` }"
11
+ >
12
+ <div class="c-sidebar-left-inner">
13
+ <slot></slot>
14
+ </div>
15
+ <span
16
+ class="c-sidebar-left-toggle"
17
+ :class="!isOpen && 'close-sidebar-left'"
18
+ @click="toggleLeftSide"
19
+ :title="isOpen ? '收起侧边栏' : '打开侧边栏'"
20
+ >
21
+ <el-icon>
22
+ <ArrowRight v-if="!isOpen" />
23
+ <ArrowLeft v-else />
24
+ </el-icon>
25
+ </span>
26
+ </aside>
27
+ </template>
28
+
29
+ <script>
30
+ import Bus from "../utils/bus";
31
+ import { isApp } from "../assets/js/app.js";
32
+ import { getDecoration } from "../service/cms";
33
+ import JX3BOX from "@jx3box/jx3box-common/data/jx3box.json";
34
+ const DECORATION_SIDEBAR = "decoration_sidebar";
35
+ export default {
36
+ name: "LeftSidebar",
37
+ props: ["open", "withoutBread", "uid"],
38
+ data: function () {
39
+ return {
40
+ isOpen: true,
41
+ user_id: null,
42
+ isApp: isApp(),
43
+ bg: "",
44
+ };
45
+ },
46
+ computed: {
47
+ stickyHeader: function () {
48
+ return this.withoutBread;
49
+ },
50
+ },
51
+ watch: {
52
+ open: function (newval) {
53
+ this.isOpen = newval === undefined ? true : !!newval;
54
+ },
55
+ uid: function (newval) {
56
+ this.user_id = newval;
57
+ this.getDecoration();
58
+ },
59
+ },
60
+ methods: {
61
+ toggleLeftSide: function () {
62
+ let status = !this.isOpen;
63
+ Bus.emit("toggleLeftSide", status);
64
+ },
65
+ showDecoration: function (val, type) {
66
+ return JX3BOX.__imgPath + `decoration/images/${val}/${type}.png`;
67
+ },
68
+ getDecoration() {
69
+ if (!this.user_id) {
70
+ return;
71
+ }
72
+ let decoration_sidebar = sessionStorage.getItem(DECORATION_SIDEBAR + this.user_id) || "";
73
+ if (decoration_sidebar == "no") return;
74
+ //已有缓存,读取解析
75
+ try {
76
+ let sidebar = JSON.parse(decoration_sidebar);
77
+ this.bg = this.showDecoration(sidebar.val, "sidebar");
78
+ } catch (err) {
79
+ getDecoration({ using: 1, user_id: this.user_id, type: "sidebar" }).then((data) => {
80
+ let res = data.data.data || [];
81
+ if (res.length == 0) {
82
+ //空 则为无主题,不再加载接口,界面设No
83
+ sessionStorage.setItem(DECORATION_SIDEBAR + this.user_id, "no");
84
+ return;
85
+ }
86
+ let sidebar = res[0];
87
+ this.bg = this.showDecoration(sidebar.val, "sidebar");
88
+ sessionStorage.setItem(DECORATION_SIDEBAR + this.user_id, JSON.stringify(sidebar));
89
+ });
90
+ }
91
+ },
92
+ },
93
+ mounted: function () {
94
+ Bus.on("toggleLeftSide", (data) => {
95
+ this.isOpen = data;
96
+ });
97
+
98
+ if (window.innerWidth < 1024) {
99
+ this.isOpen = false;
100
+
101
+ document.addEventListener("click", function () {
102
+ Bus.emit("toggleLeftSide", false);
103
+ });
104
+ }
105
+ },
106
+ created: function () {
107
+ this.isOpen = this.open === undefined ? true : this.open;
108
+ this.user_id = this.uid;
109
+ this.getDecoration();
110
+ },
111
+ };
112
+ </script>
113
+
114
+ <style lang="less">
115
+ @import "../assets/css/left-sidebar.less";
116
+ // 虚拟装扮主题
117
+ .m-theme {
118
+ // background: url(../assets/testbg.png) no-repeat;
119
+ background-repeat: no-repeat;
120
+ background-size: contain;
121
+ background-position: top right;
122
+ }
123
+ </style>
package/src/Main.vue ADDED
@@ -0,0 +1,48 @@
1
+ <template>
2
+ <main
3
+ class="c-main"
4
+ :class="{
5
+ 'without-right': withoutRight,
6
+ 'without-left': expanding,
7
+ 'without-bread': withoutBread,
8
+ }"
9
+ >
10
+ <slot></slot>
11
+ </main>
12
+ </template>
13
+
14
+ <script>
15
+ import Bus from "../utils/bus";
16
+ export default {
17
+ name: "CommonMain",
18
+ props: ["withoutRight", "withoutLeft", "withoutBread"],
19
+ data: function () {
20
+ return {
21
+ expanding: false,
22
+ };
23
+ },
24
+ computed: {
25
+ stickyHeader: function () {
26
+ return this.withoutBread;
27
+ },
28
+ },
29
+ watch: {
30
+ withoutLeft: function (newval) {
31
+ this.expanding = this.withoutLeft === undefined ? false : newval;
32
+ },
33
+ },
34
+ methods: {},
35
+ mounted: function () {
36
+ Bus.on("toggleLeftSide", (data) => {
37
+ this.expanding = !data;
38
+ });
39
+ },
40
+ created: function () {
41
+ this.expanding = this.withoutLeft === undefined ? false : !!this.withoutLeft;
42
+ },
43
+ };
44
+ </script>
45
+
46
+ <style lang="less">
47
+ @import "../assets/css/main.less";
48
+ </style>
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <aside class="c-sidebar-right c-sidebar" v-if="!isApp">
3
+ <slot></slot>
4
+ </aside>
5
+ </template>
6
+
7
+ <script>
8
+ import { isApp } from "../assets/js/app.js";
9
+ export default {
10
+ name: "RightSidebar",
11
+ props: [],
12
+ data: function () {
13
+ return {
14
+ isApp: isApp(),
15
+ };
16
+ },
17
+ computed: {},
18
+ methods: {},
19
+ mounted: function () {},
20
+ };
21
+ </script>
22
+
23
+ <style lang="less">
24
+ @import "../assets/css/right-sidebar.less";
25
+ </style>
@@ -0,0 +1,308 @@
1
+ <template>
2
+ <el-drawer
3
+ class="c-admin"
4
+ title="管理面板"
5
+ v-model="dialog_visible"
6
+ :before-close="close"
7
+ append-to-body
8
+ :modal="false"
9
+ :with-header="false"
10
+ v-if="hasRight"
11
+ ref="adminDrawer"
12
+ >
13
+ <div class="c-admin-wrapper">
14
+ <!-- <template v-if="isAdmin"> -->
15
+ <el-divider content-position="left">状态变更</el-divider>
16
+ <el-radio-group v-model="post_status" size="small" class="c-admin-status">
17
+ <el-radio-button v-for="(option, key) in status_options" :label="key" :key="key">{{
18
+ option
19
+ }}</el-radio-button>
20
+ </el-radio-group>
21
+ <!-- </template> -->
22
+
23
+ <el-divider content-position="left">可见性变更</el-divider>
24
+ <el-radio-group v-model="visible" size="small" class="c-admin-status">
25
+ <el-radio-button v-for="(option, key) in visible_options" :label="key" :key="key">{{
26
+ option
27
+ }}</el-radio-button>
28
+ </el-radio-group>
29
+
30
+ <el-divider content-position="left">推荐角标</el-divider>
31
+ <el-checkbox-group v-model="mark" class="c-admin-mark">
32
+ <el-checkbox v-for="(option, key) in mark_options" :label="key" :key="key">{{ option }}</el-checkbox>
33
+ </el-checkbox-group>
34
+
35
+ <el-divider content-position="left">加粗高亮</el-divider>
36
+ <el-checkbox class="c-admin-highlight-checkbox" v-model="isHighlight">开启高亮</el-checkbox>
37
+ <template v-if="isHighlight">
38
+ <el-color-picker
39
+ class="c-admin-highlight-block"
40
+ v-model="color"
41
+ :predefine="color_options"
42
+ size="small"
43
+ ></el-color-picker>
44
+ <span class="c-admin-highlight-preview" :style="{ color: color }">预览高亮效果</span>
45
+ </template>
46
+
47
+ <el-divider content-position="left">是否置顶</el-divider>
48
+ <el-switch v-model="isSticky" active-text="置顶" class="switch-post-pinned drawer-item-content"></el-switch>
49
+
50
+ <el-divider content-position="left">封面海报</el-divider>
51
+ <div class="c-admin-banner">
52
+ <el-upload
53
+ class="c-admin-upload el-upload--picture-card"
54
+ :action="uploadurl"
55
+ :with-credentials="true"
56
+ :show-file-list="false"
57
+ :on-success="uploadSuccess"
58
+ :on-error="uploadFail"
59
+ >
60
+ <img v-if="post_banner" :src="post_banner" />
61
+ <el-icon><Plus /></el-icon>
62
+ </el-upload>
63
+ <el-input class="u-banner" v-model="post_banner" size="small">
64
+ <template #prepend>
65
+ <span>海报地址</span>
66
+ </template>
67
+ <template #append>
68
+ <span>
69
+ <span class="u-btn" @click="removeBanner">
70
+ <el-icon><CircleClose /></el-icon> 移除海报
71
+ </span>
72
+ </span>
73
+ </template>
74
+ </el-input>
75
+ </div>
76
+
77
+ <el-divider content-position="left">元信息</el-divider>
78
+ <div class="c-admin-info">
79
+ <div class="c-admin-type">
80
+ <el-select v-model="post_type" placeholder="请选择类型" class="drawer-item-content">
81
+ <el-option
82
+ v-for="type in type_options"
83
+ :key="type.value"
84
+ :label="type.label"
85
+ :value="type.value"
86
+ ></el-option>
87
+ </el-select>
88
+ </div>
89
+ <div class="c-admin-author">
90
+ <el-input
91
+ v-model="post_author"
92
+ placeholder="请输入作者uid"
93
+ class="input-author drawer-item-content"
94
+ ></el-input>
95
+ </div>
96
+ </div>
97
+
98
+ <div class="c-admin-buttons">
99
+ <el-button type="primary" @click="submit" :loading="pushing">提交</el-button>
100
+ <el-button plain @click="close">取消</el-button>
101
+ </div>
102
+ </div>
103
+ </el-drawer>
104
+ </template>
105
+
106
+ <script>
107
+ import Bus from "../../utils/bus";
108
+ import { getRewrite } from "@jx3box/jx3box-common/js/utils";
109
+ import JX3BOX from "@jx3box/jx3box-common/data/jx3box.json";
110
+ import { getSetting, postSetting } from "../../service/admin";
111
+ import User from "@jx3box/jx3box-common/js/user";
112
+ import MARK from "@jx3box/jx3box-common/data/mark.json";
113
+ import { onClickOutside } from "@vueuse/core";
114
+ export default {
115
+ name: "BreadAdmin",
116
+ data() {
117
+ return {
118
+ // 可视
119
+ dialog_visible: false,
120
+
121
+ // 数据
122
+ pulled: false,
123
+ pushing: false,
124
+
125
+ // 权限
126
+ hasRight: false,
127
+ pid: 0,
128
+ channel: "",
129
+
130
+ // 状态
131
+ post_status: "publish",
132
+ status_options: {
133
+ publish: "默认",
134
+ draft: "草稿",
135
+ pending: "待审核",
136
+ dustbin: "删除",
137
+ },
138
+ visible: "0",
139
+ visible_options: JX3BOX.__visibleMap,
140
+
141
+ // 角标
142
+ mark: [],
143
+ mark_options: MARK.cms,
144
+
145
+ // 高亮
146
+ isHighlight: false,
147
+ color: "rgb(255,0,1)",
148
+ color_options: [
149
+ "rgb(255,0,1)",
150
+ "rgb(2,209,248)",
151
+ "rgb(147,217,25)",
152
+ "rgb(255,154,2)",
153
+ "rgb(255,44,142)",
154
+ "rgb(142,46,255)",
155
+ ],
156
+
157
+ // 置顶
158
+ isSticky: false,
159
+ sticky: 0,
160
+
161
+ // 海报
162
+ uploadurl: JX3BOX.__cms + "api/cms/upload",
163
+ banner_preview: "",
164
+ post_banner: "",
165
+
166
+ // 类型
167
+ post_type: "",
168
+ type_options: [],
169
+
170
+ // 作者
171
+ post_author: "",
172
+ };
173
+ },
174
+ computed: {
175
+ data: function () {
176
+ return {
177
+ ID: this.pid,
178
+ post_status: this.post_status || "publish",
179
+ visible: this.visible || "0",
180
+ post_author: this.post_author || 1,
181
+ post_type: this.post_type || "bbs",
182
+ post_banner: this.post_banner || "",
183
+ color: this.isHighlight ? this.color : "",
184
+ mark: this.mark || [],
185
+ sticky: this.isSticky ? Date.now() : null,
186
+ };
187
+ },
188
+ isAdmin: function () {
189
+ return User.isAdmin();
190
+ },
191
+ },
192
+ methods: {
193
+ // 是否有权限
194
+ checkHasRight: function () {
195
+ this.hasRight = User.isEditor();
196
+ },
197
+ // 获取pid
198
+ checkPostID: function () {
199
+ this.pid = getRewrite("pid") || (this.$route && this.$route.params && this.$route.params.id) || 0;
200
+ },
201
+ // 获取type
202
+ checkChannel: function () {
203
+ this.channel = location.pathname.split("/")[1];
204
+ },
205
+ // 加载类型选项
206
+ initTypeOptions: function () {
207
+ let types = [];
208
+ for (let key in JX3BOX.__postType) {
209
+ types.push({
210
+ value: key,
211
+ label: JX3BOX.__postType[key],
212
+ });
213
+ }
214
+ this.type_options = types;
215
+ },
216
+ // 上传
217
+ uploadSuccess: function (res, file) {
218
+ this.banner_preview = URL.createObjectURL(file.raw);
219
+ this.post_banner = res.data[0];
220
+ },
221
+ uploadFail: function (err) {
222
+ this.$message.error("上传失败");
223
+ console.log(err);
224
+ },
225
+ removeBanner: function () {
226
+ this.post_banner = "";
227
+ },
228
+ // 关闭
229
+ close() {
230
+ this.dialog_visible = false;
231
+ },
232
+ // 拉
233
+ pull: function () {
234
+ getSetting(this.pid).then((data) => {
235
+ let { ID, color, mark, post_status, post_author, sticky, post_banner, post_type, visible } = data;
236
+ this.pid = ID;
237
+ this.post_status = post_status;
238
+ this.visible = visible;
239
+ this.post_author = post_author;
240
+ this.post_type = post_type;
241
+ this.post_banner = post_banner;
242
+ this.color = color;
243
+ if (this.color) this.isHighlight = true;
244
+ this.mark = mark || [];
245
+ this.sticky = sticky || 0;
246
+ if (this.sticky) this.isSticky = true;
247
+
248
+ // 设置加载完成标识
249
+ this.pulled = true;
250
+ });
251
+ },
252
+ // 提交
253
+ submit: function () {
254
+ this.pushing = true;
255
+ this.push();
256
+ },
257
+ // 推
258
+ push: function () {
259
+ postSetting(this.data)
260
+ .then(() => {
261
+ this.$message({
262
+ message: "设置成功",
263
+ type: "success",
264
+ });
265
+ })
266
+ .finally(() => {
267
+ this.pushing = false;
268
+ this.close();
269
+ });
270
+ },
271
+ },
272
+ watch: {
273
+ "$route.params.id": function () {
274
+ this.checkPostID();
275
+ },
276
+ },
277
+ created: function () {
278
+ // 是否mount
279
+ this.checkHasRight();
280
+ // 预设信息
281
+ this.initTypeOptions();
282
+ },
283
+ mounted: function () {
284
+ // 基本信息
285
+ this.checkPostID();
286
+ this.checkChannel();
287
+
288
+ // 绑定监听
289
+ Bus.on("toggleAdminPanel", () => {
290
+ this.dialog_visible = !this.dialog_visible;
291
+ this.checkPostID();
292
+ // 文章类型的加载
293
+ if (this.pid && this.hasRight) {
294
+ this.pull();
295
+ }
296
+ });
297
+
298
+ // 点击外部关闭
299
+ onClickOutside(this.$refs.adminDrawer, () => {
300
+ this.close();
301
+ });
302
+ },
303
+ };
304
+ </script>
305
+
306
+ <style lang="less">
307
+ @import "../../assets/css/admin.less";
308
+ </style>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <el-button
3
+ v-if="show"
4
+ class="c-admin-button"
5
+ type="primary"
6
+ :size="button_size"
7
+ icon="Setting"
8
+ @click="toggleAdminPanel"
9
+ >管理</el-button
10
+ >
11
+ </template>
12
+
13
+ <script>
14
+ import Bus from "../../utils/bus";
15
+ import User from "@jx3box/jx3box-common/js/user";
16
+ export default {
17
+ name: "BreadAdminButton",
18
+ props: ["size"],
19
+ data: function () {
20
+ return {
21
+ show: User.isEditor(),
22
+ button_size: this.size || "",
23
+ };
24
+ },
25
+ methods: {
26
+ toggleAdminPanel: function () {
27
+ Bus.emit("toggleAdminPanel");
28
+ },
29
+ },
30
+ };
31
+ </script>