@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
@@ -0,0 +1,141 @@
1
+ <template>
2
+ <div class="c-header-user" id="c-header-user">
3
+ <template v-if="isLogin">
4
+ <!-- 消息中心 -->
5
+ <message />
6
+
7
+ <!-- 创作中心 -->
8
+ <publish />
9
+
10
+ <!-- vip -->
11
+ <vip />
12
+
13
+ <!-- 我的资产 -->
14
+ <asset :asset="asset" />
15
+
16
+ <!-- manage -->
17
+ <manage />
18
+
19
+ <!-- user info -->
20
+ <user-info :asset="asset" @logout="logout" />
21
+ </template>
22
+ <template v-else>
23
+ <div class="c-header-login">
24
+ <a class="u-register u-default" :href="register_url">注册</a>
25
+ <em>|</em>
26
+ <a class="u-login u-default" :href="login_url">登录</a>
27
+ </div>
28
+ </template>
29
+ </div>
30
+ </template>
31
+
32
+ <script>
33
+ import User from "@jx3box/jx3box-common/js/user";
34
+ import { userSignIn } from "../../service/author";
35
+ import JX3BOX from "@jx3box/jx3box-common/data/jx3box.json";
36
+ import dayjs from "dayjs";
37
+ import isToday from "dayjs/plugin/isToday";
38
+ dayjs.extend(isToday);
39
+
40
+ import message from "./Message.vue";
41
+ import publish from "./Publish.vue";
42
+ import vip from "./Vip.vue";
43
+ import asset from "./Asset.vue";
44
+ import manage from "./Manage.vue";
45
+ import userInfo from "./UserInfo.vue";
46
+ export default {
47
+ name: "HeaderUser",
48
+ components: {
49
+ message,
50
+ publish,
51
+ vip,
52
+ asset,
53
+ manage,
54
+ userInfo,
55
+ },
56
+ data: function () {
57
+ return {
58
+ // 是否折叠
59
+ // 登录信息
60
+ user: User.getInfo(),
61
+ isLogin: User.isLogin(),
62
+
63
+ // VIP
64
+ asset: {
65
+ expire_date: "2022-03-07T00:00:00+08:00",
66
+ total_day: 395,
67
+ was_vip: 0,
68
+
69
+ pro_expire_date: "2022-03-07T00:00:00+08:00",
70
+ pro_total_day: 366,
71
+ was_pro: 0,
72
+ },
73
+
74
+ // 链接
75
+ login_url: JX3BOX.__Links.account.login + "?redirect=" + location.href,
76
+ register_url: JX3BOX.__Links.account.register + "?redirect=" + location.href,
77
+ };
78
+ },
79
+ methods: {
80
+ // 签到
81
+ signIn: function () {
82
+ try {
83
+ let user_last_login = localStorage.getItem("user_last_login");
84
+ user_last_login = (user_last_login && JSON.parse(user_last_login)) || "";
85
+
86
+ if (user_last_login && dayjs(user_last_login).isToday()) {
87
+ // console.log("已签到");
88
+ } else {
89
+ // 延迟2秒执行 feedback#501
90
+ const signTimer = setTimeout(() => {
91
+ userSignIn()
92
+ .then(() => {
93
+ let msg = this.$message({
94
+ type: "success",
95
+ message: "签到成功",
96
+ customClass: "c-header-signin",
97
+ duration: 0,
98
+ });
99
+ // 模拟手动关闭
100
+ setTimeout(() => {
101
+ msg.close();
102
+ }, 3000);
103
+ localStorage.setItem("user_last_login", JSON.stringify(dayjs()));
104
+ })
105
+ .catch(() => {
106
+ localStorage.setItem("user_last_login", JSON.stringify(dayjs()));
107
+ console.log(dayjs.tz.guess());
108
+ })
109
+ .finally(() => {
110
+ clearTimeout(signTimer);
111
+ });
112
+ }, 2000);
113
+ }
114
+ } catch (e) {
115
+ console.log(e);
116
+ }
117
+ },
118
+ // 资产
119
+ loadAsset: function () {
120
+ User.getAsset().then((data) => {
121
+ this.asset = data;
122
+ });
123
+ },
124
+ // 初始化
125
+ init: function () {
126
+ if (this.isLogin) {
127
+ this.loadAsset();
128
+ this.signIn();
129
+ }
130
+ },
131
+
132
+ // 退出登录
133
+ logout: function () {
134
+ this.isLogin = false;
135
+ },
136
+ },
137
+ created: function () {
138
+ this.init();
139
+ },
140
+ };
141
+ </script>
@@ -0,0 +1,175 @@
1
+ <template>
2
+ <div class="c-header-panel c-header-info">
3
+ <div class="c-header-profile" id="c-header-profile">
4
+ <img class="u-avatar" :src="showAvatar(user.user_avatar)" />
5
+ <template v-if="isPhone">
6
+ <ul class="u-menu u-pop-content">
7
+ <li>
8
+ <a href="/dashboard">个人中心</a>
9
+ </li>
10
+ <li>
11
+ <a :href="url.msg">消息中心</a>
12
+ </li>
13
+ <li>
14
+ <a :href="url.publish">发布中心</a>
15
+ </li>
16
+ <hr />
17
+ <li v-if="isAdmin">
18
+ <a href="/admin">站点配置</a>
19
+ </li>
20
+ <li v-if="isEditor">
21
+ <a href="https://os.jx3box.com/admin">管理平台</a>
22
+ </li>
23
+ <li>
24
+ <a @click="logout">退出登录</a>
25
+ </li>
26
+ </ul>
27
+ </template>
28
+ <template v-else>
29
+ <div class="c-header-userdata u-pop-content">
30
+ <div class="u-profile">
31
+ <div class="u-basic">
32
+ <a class="u-displayname" :href="url.homepage" :title="user.display_name" target="_blank">{{
33
+ showUserName(user.display_name)
34
+ }}</a>
35
+ <a class="u-sign" href="/dashboard/cooperation">
36
+ <img
37
+ :src="super_author_icon"
38
+ class="u-superauthor-profile"
39
+ alt="superauthor"
40
+ title="签约作者"
41
+ :class="{ off: !isSuperAuthor }"
42
+ /></a>
43
+ <a
44
+ class="u-vip"
45
+ href="/vip/premium?from=header_usermenu"
46
+ target="_blank"
47
+ title="专业版账号"
48
+ >
49
+ <i class="i-icon-vip" :class="{ on: isPRO }">{{ vipType }}</i>
50
+ </a>
51
+ </div>
52
+ <div class="u-id">
53
+ <span
54
+ >魔盒UID:<b>{{ user.ID }}</b></span
55
+ >
56
+ <el-icon @click.stop="copyText(user.ID)"><DocumentCopy /></el-icon>
57
+ </div>
58
+ </div>
59
+
60
+ <el-button-group class="u-actions">
61
+ <a class="el-button el-button--default is-plain" href="/dashboard">个人中心</a>
62
+ <a class="el-button el-button--default is-plain" :href="url.profile">资料设置</a>
63
+ <a class="el-button el-button--default is-plain" href="/dashboard/frame">主题风格</a>
64
+ </el-button-group>
65
+
66
+ <div class="u-other">
67
+ <a href="/dashboard/fav" class="u-item"
68
+ ><el-icon><Star /></el-icon>收藏订阅
69
+ </a>
70
+ <a href="/team/role/manage" class="u-item"
71
+ ><el-icon><User /></el-icon>角色管理
72
+ </a>
73
+ <a href="/dashboard/purchases" class="u-item"
74
+ ><el-icon><ShoppingCart /></el-icon>已购资源
75
+ </a>
76
+ <a href="/dashboard/mall" class="u-item"
77
+ ><el-icon><ShoppingBag /></el-icon>订单中心
78
+ </a>
79
+ <hr />
80
+ <a href="/dashboard/feedback" class="u-item"
81
+ ><el-icon><Phone /></el-icon>反馈帮助
82
+ </a>
83
+ <hr />
84
+ <div class="u-logout">
85
+ <el-button @click="logout" size="small" plain>退出登录</el-button>
86
+ </div>
87
+ </div>
88
+ </div>
89
+ </template>
90
+ </div>
91
+ </div>
92
+ </template>
93
+
94
+ <script>
95
+ import User from "@jx3box/jx3box-common/js/user";
96
+ import { showAvatar } from "@jx3box/jx3box-common/js/utils";
97
+ import { getMyInfo } from "../../service/author";
98
+ import JX3BOX from "@jx3box/jx3box-common/data/jx3box.json";
99
+ import { copyText } from "../../utils";
100
+ export default {
101
+ name: "HeaderUserInfo",
102
+ props: ["asset"],
103
+ emits: ["logout"],
104
+ data() {
105
+ return {
106
+ isPhone: window.innerWidth < 768,
107
+ // 登录信息
108
+ user: User.getInfo(),
109
+ // links
110
+ url: {
111
+ msg: JX3BOX.__Links.dashboard.msg,
112
+ publish: JX3BOX.__Links.dashboard.publish,
113
+ dashboard: JX3BOX.__Links.dashboard.home,
114
+ profile: JX3BOX.__Links.dashboard.profile,
115
+ homepage: "/author/" + User.getInfo().uid,
116
+ },
117
+
118
+ isSuperAuthor: false,
119
+ };
120
+ },
121
+ computed: {
122
+ siteRoot: function () {
123
+ return location.host.includes("origin") ? JX3BOX.__OriginRoot : JX3BOX.__Root;
124
+ },
125
+ super_author_icon: function () {
126
+ return JX3BOX.__imgPath + "image/user/" + "superauthor.svg";
127
+ },
128
+ vipType: function () {
129
+ return "PRO";
130
+ },
131
+ isPRO: function () {
132
+ return User._isPRO(this.asset) || false;
133
+ },
134
+ isAdmin() {
135
+ return User.isAdmin();
136
+ },
137
+ isEditor() {
138
+ return User.isEditor();
139
+ },
140
+ },
141
+ mounted() {
142
+ this.loadMyInfo();
143
+ },
144
+ methods: {
145
+ copyText,
146
+ showAvatar,
147
+ logout: function () {
148
+ User.destroy()
149
+ .then(() => {
150
+ this.$emit("logout");
151
+ if (location.pathname.startsWith("/dashboard") || location.pathname.startsWith("/publish")) {
152
+ location.href = this.siteRoot;
153
+ }
154
+ })
155
+ .then(() => {
156
+ this.$notify({
157
+ title: "成功",
158
+ message: "登出成功",
159
+ type: "success",
160
+ duration: 1000,
161
+ });
162
+ });
163
+ },
164
+ showUserName: function (val) {
165
+ return val || "匿名";
166
+ },
167
+ loadMyInfo: function () {
168
+ getMyInfo().then((data) => {
169
+ this.user = data;
170
+ this.isSuperAuthor = !!data.sign;
171
+ });
172
+ },
173
+ },
174
+ };
175
+ </script>
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <div class="c-header-panel c-header-vip" id="c-header-vip">
3
+ <el-tooltip effect="dark" content="会员中心" placement="bottom" popper-class="c-header-tooltip">
4
+ <a class="u-post u-vip" href="/vip/premium">
5
+ <img class="u-add" svg-inline src="../../assets/img/header/vip.svg" />
6
+ </a>
7
+ </el-tooltip>
8
+ </div>
9
+ </template>
10
+
11
+ <script>
12
+ export default {
13
+ name: "HeaderVip",
14
+ };
15
+ </script>
16
+
17
+ <style lang="less" scoped>
18
+ .c-header-vip {
19
+ height: 100%;
20
+ .u-vip {
21
+ padding: 0 10px;
22
+ height: 100%;
23
+ .flex;
24
+ align-items: center;
25
+ }
26
+ }
27
+ </style>
package/src/main.js ADDED
@@ -0,0 +1,30 @@
1
+ // 1.Create APP
2
+ import { createApp } from "vue";
3
+ import App from "./App.vue";
4
+ const app = createApp(App);
5
+
6
+ // 2.Components
7
+ import { createHead } from "@vueuse/head";
8
+ const head = createHead();
9
+ app.use(head);
10
+
11
+ // element-plus
12
+ import ElementPlus from "element-plus";
13
+ import zhCn from "element-plus/es/locale/lang/zh-cn";
14
+ import "element-plus/dist/index.css";
15
+ import "../assets/css/var.less";
16
+
17
+ import "@jx3box/jx3box-common/css/normalize.css";
18
+
19
+ app.use(ElementPlus, {
20
+ locale: zhCn,
21
+ });
22
+
23
+ import * as ElementPlusIconsVue from "@element-plus/icons-vue";
24
+
25
+ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
26
+ app.component(key, component);
27
+ }
28
+
29
+ // 3.Mount DOM
30
+ app.mount("#app");
package/utils/bus.js ADDED
@@ -0,0 +1,5 @@
1
+ import mitt from "mitt";
2
+
3
+ const emitter = mitt();
4
+
5
+ export default emitter;
package/utils/index.js ADDED
@@ -0,0 +1,31 @@
1
+ import { ElNotification } from "element-plus";
2
+ // 复制
3
+ export function copyText(text) {
4
+ if (window.navigator.clipboard) {
5
+ window.navigator.clipboard.writeText(text).then(
6
+ function () {
7
+ ElNotification.success({
8
+ title: "复制成功",
9
+ });
10
+ console.log("Async: Copying to clipboard was successful!");
11
+ },
12
+ function (err) {
13
+ console.error("Async: Could not copy text: ", err);
14
+ }
15
+ );
16
+ } else {
17
+ var textArea = document.createElement("textarea");
18
+ textArea.value = text;
19
+ document.body.appendChild(textArea);
20
+ textArea.focus();
21
+ textArea.select();
22
+ try {
23
+ var successful = document.execCommand("copy");
24
+ var msg = successful ? "successful" : "unsuccessful";
25
+ console.log("Fallback: Copying text command was " + msg);
26
+ } catch (err) {
27
+ console.error("Fallback: Oops, unable to copy", err);
28
+ }
29
+ document.body.removeChild(textArea);
30
+ }
31
+ }
package/vue.config.js ADDED
@@ -0,0 +1,103 @@
1
+ const path = require("path");
2
+ module.exports = {
3
+ //❤️ define path for static files ~
4
+ publicPath: process.env.NODE_ENV === "development" ? "/" : process.env.STATIC_PATH,
5
+
6
+ //⚛️ Proxy ~
7
+ devServer: {
8
+ proxy: {
9
+ "/api/vip": {
10
+ target: "https://pay.jx3box.com",
11
+ onProxyReq: function (request) {
12
+ request.setHeader("origin", "");
13
+ },
14
+ },
15
+ "/api/inspire": {
16
+ target: "https://pay.jx3box.com",
17
+ onProxyReq: function (request) {
18
+ request.setHeader("origin", "");
19
+ },
20
+ },
21
+ "/api/team": {
22
+ target: "https://team.api.jx3box.com",
23
+ onProxyReq: function (request) {
24
+ request.setHeader("origin", "");
25
+ },
26
+ },
27
+ "/api/cms": {
28
+ target: process.env["DEV_SERVER"] == "true" ? "http://localhost:5120" : "https://cms.jx3box.com",
29
+ },
30
+ "/api/article": {
31
+ target: "https://next2.jx3box.com",
32
+ },
33
+ "/api/messages": {
34
+ target: "https://helper.jx3box.com",
35
+ },
36
+ "/api/post/favorite": {
37
+ target: "https://helper.jx3box.com",
38
+ },
39
+ "/api/wiki": {
40
+ target: "https://helper.jx3box.com",
41
+ },
42
+ "/api/personal": {
43
+ target: "https://pay.jx3box.com",
44
+ onProxyReq: function (request) {
45
+ request.setHeader("origin", "");
46
+ },
47
+ },
48
+ "/api/cny": {
49
+ target: "https://pay.jx3box.com",
50
+ onProxyReq: function (request) {
51
+ request.setHeader("origin", "");
52
+ },
53
+ },
54
+ "/api": {
55
+ target: "https://next2.jx3box.com",
56
+ onProxyReq: function (request) {
57
+ request.setHeader("origin", "");
58
+ },
59
+ },
60
+ },
61
+ },
62
+
63
+ //❤️ Webpack configuration
64
+ chainWebpack: (config) => {
65
+ //💘 html-webpack-plugin ~
66
+ // Multiple pages disable the block below
67
+ // config.plugin("html").tap((args) => {
68
+ // args[0].meta = {
69
+ // //------设置SEO信息
70
+ // Keywords: setting.keys,
71
+ // Description: setting.desc,
72
+ // };
73
+ // args[0].title = setting.title; //------自动添加标题后缀
74
+ // return args;
75
+ // });
76
+
77
+ //💝 in-line small imgs ~
78
+ config.module.rule("images").set("parser", {
79
+ dataUrlCondition: {
80
+ maxSize: 4 * 1024, // 4KiB
81
+ },
82
+ });
83
+
84
+ //💝 in-line svg imgs ~
85
+ config.module.rule("vue").use("vue-svg-inline-loader").loader("vue-svg-inline-loader");
86
+
87
+ //💖 import common less var * mixin ~
88
+ const types = ["vue-modules", "vue", "normal-modules", "normal"];
89
+ types.forEach((type) => addStyleResource(config.module.rule("less").oneOf(type)));
90
+ },
91
+ };
92
+
93
+ function addStyleResource(rule) {
94
+ var preload_styles = [];
95
+ preload_styles.push(
96
+ path.resolve(__dirname, "./node_modules/@jx3box/jx3box-common/css/common.less"),
97
+ path.resolve(__dirname, "./node_modules/csslab/base.less"),
98
+ path.resolve(__dirname, "./src/assets/css/var.less")
99
+ );
100
+ rule.use("style-resource").loader("style-resources-loader").options({
101
+ patterns: preload_styles,
102
+ });
103
+ }