@jx3box/jx3box-ui 2.0.4 → 2.0.6

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 (227) hide show
  1. package/.storybook/main.js +208 -0
  2. package/.storybook/preview.js +93 -0
  3. package/.storybook/storybookMocks.js +191 -0
  4. package/README.md +29 -82
  5. package/assets/css/bread/admin.less +20 -2
  6. package/assets/css/bread/breadcrumb.less +5 -2
  7. package/assets/css/comment/quick-reply.less +1 -1
  8. package/assets/css/common/left-sidebar.less +1 -1
  9. package/assets/css/interact/like2.less +5 -2
  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/data/nav.json +344 -10
  14. package/assets/img/comment/comment.svg +1 -1
  15. package/assets/img/comment/heart_1.svg +1 -1
  16. package/assets/img/comment/hide.svg +1 -1
  17. package/assets/img/leftsidebar/medal.svg +1 -1
  18. package/assets/img/leftsidebar/post.svg +27 -46
  19. package/i18n/messages/en-US.js +357 -22
  20. package/i18n/messages/vi.js +350 -22
  21. package/i18n/messages/zh-CN.js +469 -20
  22. package/i18n/messages/zh-TW.js +350 -22
  23. package/index.js +19 -7
  24. package/package.json +15 -5
  25. package/service/cms.js +22 -0
  26. package/service/commit-history.js +18 -0
  27. package/service/community.js +60 -0
  28. package/service/fav.js +5 -6
  29. package/src/App.vue +154 -80
  30. package/src/Breadcrumb.vue +24 -11
  31. package/src/CommonFooter.vue +4 -4
  32. package/src/Footer.vue +13 -5
  33. package/src/LeftSideToggle.vue +10 -3
  34. package/src/LeftSidebar.vue +19 -5
  35. package/src/Main.vue +9 -2
  36. package/src/RightSidebar.vue +12 -3
  37. package/src/SuspendCommon.vue +52 -38
  38. package/src/author/AuthorFans.vue +7 -5
  39. package/src/author/AuthorFollow.vue +14 -7
  40. package/src/author/AuthorGift.vue +25 -17
  41. package/src/author/AuthorInfo.vue +46 -19
  42. package/src/author/AuthorLink.vue +3 -1
  43. package/src/author/AuthorMedals.vue +5 -2
  44. package/src/author/AuthorPosts.vue +31 -13
  45. package/src/author/AuthorRss.vue +7 -3
  46. package/src/author/AuthorTeams.vue +3 -1
  47. package/src/author/UserPop.vue +29 -17
  48. package/src/bread/Admin.vue +55 -32
  49. package/src/bread/AdminDirectMessage.vue +15 -8
  50. package/src/bread/AdminDrop.vue +124 -45
  51. package/src/bread/CommunityAdmin.vue +527 -0
  52. package/src/bread/DesignTask.vue +30 -26
  53. package/src/bread/ListAdmin.vue +199 -0
  54. package/src/bread/MigrateCommunity.vue +192 -0
  55. package/src/bread/MoveToCommunityDialog.vue +234 -0
  56. package/src/comment/Avatar.vue +18 -24
  57. package/src/comment/CommentContent.vue +57 -37
  58. package/src/comment/CommentContentSimple.vue +61 -63
  59. package/src/comment/CommentInputForm.vue +45 -34
  60. package/src/comment/CommentWithReply.vue +9 -6
  61. package/src/comment/QuickReply.vue +5 -1
  62. package/src/comment/ReplyForReply.vue +6 -4
  63. package/src/comment/ReplyList.vue +28 -18
  64. package/src/comment/Upload.vue +24 -6
  65. package/src/filters/clientBy.vue +10 -8
  66. package/src/filters/markBy.vue +35 -31
  67. package/src/filters/menuBy.vue +20 -22
  68. package/src/filters/orderBy.vue +17 -11
  69. package/src/filters/tagBy.vue +4 -2
  70. package/src/filters/topicBy.vue +12 -10
  71. package/src/filters/versionBy.vue +5 -3
  72. package/src/filters/zlpBy.vue +29 -25
  73. package/src/footer/copyright.vue +5 -5
  74. package/src/footer/links.vue +2 -2
  75. package/src/footer/official.vue +1 -1
  76. package/src/footer/resource.vue +41 -8
  77. package/src/header/alternate.vue +35 -18
  78. package/src/header/asset.vue +9 -19
  79. package/src/header/box.vue +20 -8
  80. package/src/header/box2.vue +25 -13
  81. package/src/header/client.vue +7 -7
  82. package/src/header/lang.vue +41 -6
  83. package/src/header/logo.vue +2 -3
  84. package/src/header/manage.vue +2 -2
  85. package/src/header/message.vue +3 -3
  86. package/src/header/nav.vue +26 -23
  87. package/src/header/publish.vue +2 -2
  88. package/src/header/search.vue +2 -2
  89. package/src/header/shop.vue +2 -2
  90. package/src/header/user.vue +4 -4
  91. package/src/header/userInfo.vue +22 -24
  92. package/src/header/vip.vue +2 -2
  93. package/src/interact/BoxcoinAdmin.vue +30 -16
  94. package/src/interact/BoxcoinRecords.vue +28 -11
  95. package/src/interact/BoxcoinUser.vue +33 -17
  96. package/src/interact/Fav.vue +5 -1
  97. package/src/interact/Homework.vue +318 -0
  98. package/src/interact/Like.vue +4 -2
  99. package/src/interact/Rss.vue +10 -4
  100. package/src/interact/Share.vue +18 -19
  101. package/src/interact/WatchLater.vue +5 -1
  102. package/src/main.js +1 -0
  103. package/src/single/Author.vue +5 -1
  104. package/src/single/CmsSingle.vue +29 -15
  105. package/src/single/Collection.vue +36 -26
  106. package/src/single/Comment.vue +19 -13
  107. package/src/single/Creators.vue +5 -3
  108. package/src/single/PostCollection.vue +158 -0
  109. package/src/single/PostDirectory.vue +0 -126
  110. package/src/single/PostGuide.vue +93 -0
  111. package/src/single/PostHeader.vue +39 -17
  112. package/src/single/PostTopic.vue +3 -3
  113. package/src/single/PostVersion.vue +219 -0
  114. package/src/single/RightAffix.vue +160 -0
  115. package/src/single/SimpleThx.vue +4 -2
  116. package/src/single/Thx.vue +14 -2
  117. package/src/single/VersionDialog.vue +238 -0
  118. package/src/stories/components/StoryPropsTable.vue +137 -0
  119. package/src/stories/filters/FilterGallery.stories.js +110 -0
  120. package/src/stories/filters/clientBy.stories.js +24 -0
  121. package/src/stories/filters/markBy.stories.js +6 -0
  122. package/src/stories/filters/menuBy.stories.js +6 -0
  123. package/src/stories/filters/orderBy.stories.js +6 -0
  124. package/src/stories/filters/tagBy.stories.js +6 -0
  125. package/src/stories/filters/topicBy.stories.js +6 -0
  126. package/src/stories/filters/versionBy.stories.js +6 -0
  127. package/src/stories/filters/zlpBy.stories.js +6 -0
  128. package/src/stories/layout/BaseShell.stories.js +38 -0
  129. package/src/stories/layout/Breadcrumb.stories.js +40 -0
  130. package/src/stories/layout/CommonFooter.stories.js +22 -0
  131. package/src/stories/layout/CommonHeader.stories.js +39 -0
  132. package/src/stories/layout/LeftSideToggle.stories.js +78 -0
  133. package/src/stories/layout/LeftSidebar.stories.js +40 -0
  134. package/src/stories/layout/Main.stories.js +41 -0
  135. package/src/stories/layout/RightSidebar.stories.js +36 -0
  136. package/src/stories/layout/StorybookShell.vue +271 -0
  137. package/src/stories/layout/SuspendCommon.stories.js +67 -0
  138. package/src/stories/layout/SuspendCommonStage.vue +143 -0
  139. package/src/stories/mockData.js +275 -0
  140. package/src/stories/other/UserPop.stories.js +51 -0
  141. package/src/stories/single/Author.stories.js +19 -0
  142. package/src/stories/single/AuthorStoryStage.vue +103 -0
  143. package/src/stories/single/CmsSingle.stories.js +19 -0
  144. package/src/stories/single/CmsSingleStoryStage.vue +118 -0
  145. package/src/stories/single/Collection.stories.js +34 -0
  146. package/src/stories/single/Comment.stories.js +36 -0
  147. package/src/stories/single/Creators.stories.js +34 -0
  148. package/src/stories/single/PostCollection.stories.js +34 -0
  149. package/src/stories/single/PostDirectory.stories.js +31 -0
  150. package/src/stories/single/PostGuide.stories.js +47 -0
  151. package/src/stories/single/PostHeader.stories.js +39 -0
  152. package/src/stories/single/PostVersion.stories.js +41 -0
  153. package/src/stories/single/RightAffix.stories.js +84 -0
  154. package/src/stories/single/SimpleThx.stories.js +39 -0
  155. package/src/stories/single/SingleGallery.stories.js +207 -0
  156. package/src/stories/single/Thx.stories.js +38 -0
  157. package/vue.config.js +2 -12
  158. package/assets/css/common/bottom.less +0 -25
  159. package/assets/css/editor/article.less +0 -36
  160. package/assets/css/editor/combo.less +0 -362
  161. package/assets/css/editor/resource.less +0 -399
  162. package/assets/css/editor/tinymce.less +0 -100
  163. package/assets/css/editor/upload.less +0 -136
  164. package/assets/css/module/author.less +0 -231
  165. package/assets/css/module/buff.less +0 -88
  166. package/assets/css/module/directory.less +0 -165
  167. package/assets/css/module/icon.less +0 -25
  168. package/assets/css/module/item.less +0 -279
  169. package/assets/css/module/item_simple.less +0 -58
  170. package/assets/css/module/jx3_element.less +0 -5
  171. package/assets/css/module/macro.less +0 -89
  172. package/assets/css/module/npc.less +0 -265
  173. package/assets/css/module/resource.less +0 -93
  174. package/assets/css/module/skill.less +0 -74
  175. package/assets/css/module/talent.less +0 -495
  176. package/assets/js/a.js +0 -46
  177. package/assets/js/code.js +0 -13
  178. package/assets/js/combo.js +0 -40
  179. package/assets/js/directory.js +0 -114
  180. package/assets/js/filter2.js +0 -186
  181. package/assets/js/fold.js +0 -11
  182. package/assets/js/gallery.js +0 -14
  183. package/assets/js/hljs_languages.js +0 -177
  184. package/assets/js/iframe.js +0 -38
  185. package/assets/js/img.js +0 -23
  186. package/assets/js/item/attribute_percent.js +0 -88
  187. package/assets/js/item/bind.js +0 -18
  188. package/assets/js/item/border.js +0 -19
  189. package/assets/js/item/border_quest.js +0 -12
  190. package/assets/js/item/color.js +0 -25
  191. package/assets/js/item/hljs_languages.js +0 -177
  192. package/assets/js/item/icon_url.js +0 -15
  193. package/assets/js/item/second_format.js +0 -19
  194. package/assets/js/jx3_element.js +0 -73
  195. package/assets/js/katex.js +0 -181
  196. package/assets/js/macro.js +0 -16
  197. package/assets/js/nextpage.js +0 -4
  198. package/assets/js/pswp.js +0 -67
  199. package/assets/js/pswp_template.js +0 -66
  200. package/assets/js/pz_iframe.js +0 -30
  201. package/assets/js/qixue.js +0 -28
  202. package/assets/js/renderImgPreview.js +0 -18
  203. package/assets/js/script.js +0 -6
  204. package/assets/js/stat.js +0 -107
  205. package/assets/js/talent2.js +0 -21
  206. package/assets/js/tex-mml-chtml.js +0 -36310
  207. package/assets/js/voice.js +0 -238
  208. package/assets/js/xss.js +0 -130
  209. package/src/editor/Article.vue +0 -230
  210. package/src/editor/BoxResource.vue +0 -441
  211. package/src/editor/Resource.vue +0 -623
  212. package/src/editor/Tinymce.vue +0 -204
  213. package/src/editor/Upload.vue +0 -277
  214. package/src/editor/UploadAlum.vue +0 -176
  215. package/src/editor/UploadBanner.vue +0 -156
  216. package/src/editor/components/Author.vue +0 -322
  217. package/src/editor/components/Avatar.vue +0 -95
  218. package/src/editor/components/Buff.vue +0 -80
  219. package/src/editor/components/Combo.vue +0 -259
  220. package/src/editor/components/Equip.vue +0 -299
  221. package/src/editor/components/GameText.vue +0 -242
  222. package/src/editor/components/Item.vue +0 -325
  223. package/src/editor/components/ItemSimple.vue +0 -134
  224. package/src/editor/components/Medal.vue +0 -43
  225. package/src/editor/components/Npc.vue +0 -215
  226. package/src/editor/components/PostAuthor.vue +0 -102
  227. package/src/editor/components/Skill.vue +0 -71
@@ -1,156 +0,0 @@
1
- <template>
2
- <div class="c-upload-banner">
3
- <el-alert class="u-tip" :title="info" v-if="info" type="info" show-icon></el-alert>
4
- <div v-if="data" class="u-upload" :style="uploadStyle">
5
- <img :src="preview" />
6
- <i class="u-upload-mask"></i>
7
- <el-icon class="u-upload-delete el-icon-delete" title="移除" @click="remove"><Delete /></el-icon>
8
- </div>
9
- <div v-else class="u-upload el-upload el-upload--picture-card" @click="select">
10
- <el-icon><Plus /></el-icon>
11
- </div>
12
- <input
13
- class="u-upload-input"
14
- type="file"
15
- @change="upload"
16
- ref="uploadInput"
17
- accept=".jpg, .jpeg, .png, .gif, .bmp,.webp"
18
- />
19
- </div>
20
- </template>
21
-
22
- <script>
23
- import * as utilModule from "@jx3box/jx3box-common/js/utils";
24
- const { getThumbnail } = utilModule;
25
- import { upload } from "../../service/cms.js";
26
- export default {
27
- name: "upload-banner",
28
- props: {
29
- content: {
30
- type: String,
31
- default: "",
32
- },
33
- info: {
34
- type: String,
35
- // 用于展示tips
36
- default: "",
37
- },
38
- size: {
39
- type: [Array, Number],
40
- default: 148,
41
- },
42
- maxSize: {
43
- type: Number,
44
- default: 10,
45
- },
46
- },
47
- data() {
48
- return {
49
- data: this.content || "",
50
- };
51
- },
52
- model: {
53
- prop: "content",
54
- event: "input",
55
- },
56
- watch: {
57
- content(val) {
58
- this.data = val;
59
- },
60
- data(val) {
61
- this.$emit("input", val);
62
- },
63
- },
64
- computed: {
65
- fileInput: function () {
66
- return this.$refs.uploadInput;
67
- },
68
- preview() {
69
- let size = Array.isArray(this.size) ? this.size : [this.size, this.size];
70
- return getThumbnail(this.data, size, true);
71
- },
72
- uploadStyle() {
73
- let size = Array.isArray(this.size) ? this.size : [this.size, this.size];
74
- return {
75
- width: size[0] + "px",
76
- height: size[1] + "px",
77
- };
78
- },
79
- },
80
- methods: {
81
- select() {
82
- this.fileInput.dispatchEvent(
83
- new MouseEvent("click", {
84
- bubbles: true,
85
- cancelable: true,
86
- view: window,
87
- })
88
- );
89
- },
90
- upload() {
91
- const file = this.fileInput.files[0];
92
- if (!file) return;
93
- if (file.size > this.maxSize * 1024 * 1024) {
94
- this.$message.error("图片大小不能超过" + this.maxSize + "M");
95
- return;
96
- }
97
- const formData = new FormData();
98
- formData.append("file", file);
99
- upload(formData).then((res) => {
100
- this.data = res.data.data[0];
101
- this.$message({
102
- message: "上传成功",
103
- type: "success",
104
- });
105
- });
106
- },
107
- remove() {
108
- this.data = "";
109
- },
110
- },
111
- };
112
- </script>
113
-
114
- <style lang="less">
115
- .c-upload-banner {
116
- .u-tip {
117
- padding: 5px 15px;
118
- }
119
- .u-upload {
120
- .pr;
121
- .size(148px);
122
- .mt(10px);
123
- img {
124
- .size(100%);
125
- .y(bottom);
126
- }
127
- .u-upload-mask {
128
- .none;
129
- .pa;
130
- .lt(0);
131
- .size(100%);
132
- background-color: rgba(0, 0, 0, 0.6);
133
- }
134
- .u-upload-delete {
135
- .pa;
136
- .lt(50%);
137
- .size(24px);
138
- .fz(24px);
139
- padding: 40px;
140
- transform: translate(-50%, -50%);
141
- color: #fff;
142
- .pointer;
143
- .none;
144
- }
145
- &:hover {
146
- .u-upload-mask,
147
- .u-upload-delete {
148
- .db;
149
- }
150
- }
151
- }
152
- .u-upload-input {
153
- .none;
154
- }
155
- }
156
- </style>
@@ -1,322 +0,0 @@
1
- <template>
2
- <div class="w-author" v-loading="loading">
3
- <div class="w-author-wrapper el-popover" v-if="data" :style="{ backgroundImage: `url(${bg})` }">
4
- <div class="u-author">
5
- <Avatar
6
- class="u-avatar"
7
- :uid="uid"
8
- :url="data.user_avatar"
9
- :size="68"
10
- :frame="data.user_avatar_frame"
11
- />
12
- <div class="u-info">
13
- <a class="u-name" :href="authorLink(uid)" target="_blank">
14
- <el-tooltip class="item" effect="dark" content="签约作者" placement="top" v-if="isSuperAuthor">
15
- <a class="u-superauthor" href="/dashboard/cooperation" target="_blank">
16
- <img :src="super_author_icon" alt="superauthor" />
17
- </a>
18
- </el-tooltip>
19
- <span class="u-displayname" :title="data.display_name">{{ data.display_name || "未知" }}</span>
20
- </a>
21
- <div class="u-extend">
22
- <el-tooltip class="item" effect="dark" placement="top">
23
- <template #content>
24
- <span class="u-tips">经验值:{{ data.experience }}</span>
25
- </template>
26
- <span
27
- class="u-level"
28
- :class="'lv-' + level"
29
- :style="{
30
- backgroundColor: showLevelColor(level),
31
- }"
32
- >Lv.{{ level }}</span
33
- >
34
- </el-tooltip>
35
- <el-tooltip class="item" effect="dark" :content="vipTypeTitle" placement="top" v-if="isVip">
36
- <a class="u-vip" href="/vip/premium?from=sidebar_author" target="_blank">
37
- <i class="i-icon-vip on">{{ vipType }}</i>
38
- </a>
39
- </el-tooltip>
40
- </div>
41
- </div>
42
- </div>
43
- <!-- <div class="u-honor" :style="honorStyle" v-if="honor">{{ honor }}</div> -->
44
- <div class="u-trophy" v-if="hasTrophy">
45
- <div class="u-medals" v-if="medals && medals.length">
46
- <medal :medals="medals" :showIcon="showMedalIcon"></medal>
47
- </div>
48
- </div>
49
- <div class="u-teams" v-if="teams && teams.length">
50
- <a class="u-team" v-for="(item, i) in teams" :key="i" :href="teamLink(item.team_id)" target="_blank">
51
- <img class="u-team-logo" :src="showTeamLogo(item.team_logo)" />
52
- <span class="u-team-name">{{ item.team_name }}@{{ item.team_server }}</span>
53
- </a>
54
- </div>
55
- </div>
56
- </div>
57
- </template>
58
-
59
- <script>
60
- import { authorLink, getLink, getThumbnail } from "@jx3box/jx3box-common/js/utils";
61
- import { getUserInfo, getUserMedals, getUserPublicTeams } from "../../../service/author";
62
- import { getDecoration, getDecorationJson } from "../../../service/cms";
63
- import JX3BOX from "@jx3box/jx3box-common/data/jx3box.json";
64
- import User from "@jx3box/jx3box-common/js/user";
65
- import Avatar from "./Avatar.vue";
66
- import medal from "./Medal.vue";
67
- const { __imgPath, __userLevelColor } = JX3BOX;
68
-
69
- const ATCARD_KEY = "decoration_atcard";
70
- const DECORATION_JSON = "decoration_json";
71
- const DECORATION_KEY = "decoration_me";
72
- const HONOR_KEY = "honor_me";
73
- export default {
74
- name: "AuthorComponent",
75
- components: {
76
- medal,
77
- Avatar,
78
- },
79
- props: ["uid"],
80
- data: () => ({
81
- data: null,
82
- medals: [],
83
- teams: [],
84
- loading: false,
85
- bg: "",
86
- honor: "",
87
- honorStyle: {},
88
- }),
89
- computed: {
90
- super_author_icon: function () {
91
- return __imgPath + "image/user/" + "superauthor.svg";
92
- },
93
- isVip: function () {
94
- return this.data?.is_pro || this.data?.is_pre;
95
- },
96
- vipTypeTitle: function () {
97
- return this.data?.is_pro ? "专业版会员" : "高级版会员";
98
- },
99
- vipType: function () {
100
- return this.data?.is_pro ? "PRO" : "PRE";
101
- },
102
- level: function () {
103
- return User.getLevel(this.data && this.data.experience);
104
- },
105
- hasTrophy: function () {
106
- return this.medals.length;
107
- },
108
- isSuperAuthor: function () {
109
- return !!this.data?.sign;
110
- },
111
- },
112
- watch: {
113
- uid: {
114
- immediate: true,
115
- handler(val) {
116
- if (val) {
117
- this.loadData();
118
- this.getAtcard();
119
- // this.getHonor();
120
- }
121
- },
122
- },
123
- },
124
- methods: {
125
- loadData: function () {
126
- const promises = [getUserInfo(this.uid), getUserMedals(this.uid), getUserPublicTeams(this.uid)];
127
- this.loading = true;
128
- Promise.all(promises).then((res) => {
129
- this.data = res[0];
130
- this.medals = res[1];
131
- this.teams = res[2];
132
- this.loading = false;
133
- });
134
- },
135
- loadUserInfo: function () {
136
- return getUserInfo(this.uid).then((data) => {
137
- this.data = data;
138
- });
139
- },
140
- loadMedals: function () {
141
- return getUserMedals(this.uid).then((data) => {
142
- this.medals = data;
143
- });
144
- },
145
- loadTeams: function () {
146
- return getUserPublicTeams(this.uid).then((data) => {
147
- this.teams = data && data.slice(0, 5);
148
- });
149
- },
150
- getAtcard() {
151
- let decoration_atcard = sessionStorage.getItem(ATCARD_KEY + this.uid);
152
- if (decoration_atcard == "no") {
153
- this.bg = "";
154
- return;
155
- }
156
- //已有缓存,读取解析
157
- if (decoration_atcard) {
158
- this.setDecoration(decoration_atcard);
159
- return;
160
- }
161
- getDecoration({ using: 1, user_id: this.uid, type: "atcard" }).then((data) => {
162
- let res = data.data.data;
163
- if (res.length == 0) {
164
- //空 则为无主题,不再加载接口,界面设No
165
- sessionStorage.setItem(ATCARD_KEY + this.uid, "no");
166
- this.bg = "";
167
- return;
168
- }
169
- sessionStorage.setItem(ATCARD_KEY + this.uid, res[0].val);
170
- this.setDecoration(res[0].val);
171
- });
172
- },
173
- setDecoration(val) {
174
- this.bg = this.showDecoration(val, "atcard");
175
- },
176
- getHonor() {
177
- this.honor = "";
178
- let user_id = this.uid;
179
- if (!user_id) {
180
- return;
181
- }
182
- let honor_local = sessionStorage.getItem(HONOR_KEY + user_id);
183
- if (honor_local == "no") return;
184
- //已有缓存,读取解析
185
- if (honor_local) {
186
- this.honor = honor_local;
187
- this.getHonorStyle();
188
- return;
189
- }
190
- getDecoration({ using: 1, user_id: user_id, type: "honor" }).then((data) => {
191
- let res = data.data.data;
192
- if (res.length == 0) {
193
- //空 则为无主题,不再加载接口,界面设No
194
- sessionStorage.setItem(HONOR_KEY + user_id, "no");
195
- return;
196
- }
197
- let honor = res[0];
198
- sessionStorage.setItem(HONOR_KEY + user_id, honor.val);
199
- this.honor = honor.val;
200
- this.getHonorStyle();
201
- });
202
- },
203
- //有称号后,获取样式配置
204
- getHonorStyle() {
205
- let user_id = this.uid;
206
- let decoration_local = sessionStorage.getItem(DECORATION_KEY + user_id);
207
- if (decoration_local) {
208
- //解析本地缓存
209
- let decoration_parse = JSON.parse(decoration_local);
210
- if (!decoration_parse.status) return;
211
-
212
- if (decoration_parse) {
213
- this.setHonorStyle(decoration_parse);
214
- return;
215
- }
216
- }
217
- getDecoration({ using: 1, user_id: user_id, type: "homebg" }).then((data) => {
218
- let res = data.data.data;
219
- if (res.length == 0) {
220
- //空 则为无主题,不再加载接口,界面设No
221
- sessionStorage.setItem(DECORATION_KEY + user_id, JSON.stringify({ status: false }));
222
- return;
223
- }
224
- let decoration = res[0];
225
- let decorationJson = sessionStorage.getItem(DECORATION_JSON);
226
- if (!decorationJson) {
227
- //加载远程json,用于Honor颜色配置
228
- getDecorationJson().then((json) => {
229
- let decoration_json = json.data;
230
- let theme = JSON.parse(JSON.stringify(decoration_json[decoration.val]));
231
- theme.status = true;
232
- sessionStorage.setItem(DECORATION_KEY + this.uid, JSON.stringify(theme));
233
- //缓存远程JSON文件
234
- sessionStorage.setItem(DECORATION_JSON, JSON.stringify(decoration_json));
235
- this.setHonorStyle(theme);
236
- });
237
- } else {
238
- let theme = JSON.parse(decorationJson)[decoration.val];
239
- theme.status = true;
240
- sessionStorage.setItem(DECORATION_KEY + this.uid, JSON.stringify(theme));
241
- this.setHonorStyle(theme);
242
- }
243
- });
244
- },
245
- setHonorStyle(style) {
246
- this.honorStyle = {
247
- "background-color": style.buttoncolor,
248
- color: style.buttontextcolor,
249
- };
250
- },
251
-
252
- showMedalIcon: function (val) {
253
- return __imgPath + "image/medals/user/" + val + ".gif";
254
- },
255
- showMedalDesc: function (item) {
256
- return item.medal_desc
257
- },
258
- teamLink: function (team_id) {
259
- return getLink("org", team_id);
260
- },
261
- showTeamLogo: function (val) {
262
- return getThumbnail(val, 96);
263
- },
264
- showLevelColor: function (level) {
265
- return __userLevelColor[level];
266
- },
267
- showDecoration: function (val, type) {
268
- return __imgPath + `decoration/images/${val}/${type}.png`;
269
- },
270
- authorLink,
271
- },
272
- };
273
- </script>
274
-
275
- <style lang="less">
276
- @import "../../../assets/css/module/author.less";
277
- .w-author {
278
- .w-author-wrapper {
279
- background-repeat: no-repeat;
280
- background-position: top right;
281
- background-size: 100% auto;
282
- .u-author {
283
- padding: 5px 0 15px 5px;
284
- }
285
- .u-avatar {
286
- .fl;
287
- .mr(15px);
288
- }
289
- img {
290
- border: none;
291
- margin: 0;
292
- padding: 0;
293
- }
294
- a {
295
- .lh(28px);
296
- text-decoration: none;
297
- &:hover {
298
- text-decoration: none;
299
- box-shadow: none;
300
- }
301
- }
302
- .u-displayname {
303
- .fz(15px);
304
- .nobreak;
305
- max-width: 200px;
306
- color: @color;
307
- .bold;
308
- }
309
- }
310
- .u-honor {
311
- .mt(2px);
312
- .dbi;
313
- .h(18px);
314
- background-color: #494038;
315
- color: #ffffff;
316
- .fz(12px,14px);
317
- padding: 2px 50px 2px 10px;
318
- .mb(15px);
319
- .r(2px);
320
- }
321
- }
322
- </style>
@@ -1,95 +0,0 @@
1
- <template>
2
- <a class="c-avatar" :href="authorLink(uid)" target="_blank">
3
- <img :src="showAvatar(url)" class="c-avatar-pic"/>
4
- <i class="c-avatar-frame" v-if="frame">
5
- <img :src="frameUrl" />
6
- </i>
7
- <slot></slot>
8
- </a>
9
- </template>
10
-
11
- <script>
12
- import JX3BOX from "@jx3box/jx3box-common/data/jx3box.json";
13
- const { __imgPath } = JX3BOX;
14
- import { showAvatar, authorLink } from "@jx3box/jx3box-common/js/utils";
15
- export default {
16
- name: "AvatarComponent",
17
- props: ["uid", "url", "size", "frame"],
18
- components: {},
19
- data: function() {
20
- return {
21
- frames: [],
22
- styles : [
23
- {cls:'xs',size:60},
24
- {cls:'s',size:84},
25
- {cls:'m',size:136},
26
- {cls:'l',size:224},
27
- ]
28
- };
29
- },
30
- computed: {
31
- frameUrl: function() {
32
- return __imgPath + `avatar/images/${this.frame}/${this.frame}.svg`;
33
- },
34
- },
35
- methods: {
36
- showAvatar: function(val) {
37
- return showAvatar(val, this.size*3);
38
- },
39
- authorLink,
40
- },
41
- mounted : function (){
42
- }
43
- };
44
- </script>
45
-
46
- <style scoped lang="less">
47
- .c-avatar {
48
- .pr;
49
- .dbi;
50
- }
51
- .c-avatar-pic {
52
- .db;
53
- .size(100%);
54
- .r(100%);
55
- }
56
- .c-avatar-frame {
57
- .pa;
58
- .lt(-10px);
59
- .size(100%);
60
- padding: 10px;
61
- box-sizing: content-box;
62
- img {
63
- .db;
64
- .pa;
65
- .size(100%);
66
- .lt(0);
67
- }
68
-
69
- &.xs {
70
- left: -6px;
71
- top: -6px;
72
- width: 60px;
73
- height: 60px;
74
- }
75
-
76
- &.s {
77
- left: -8px;
78
- top: -8px;
79
- width: 84px;
80
- height: 84px;
81
- }
82
- &.m {
83
- left: -8px;
84
- top: -8px;
85
- width: 136px;
86
- height: 136px;
87
- }
88
- &.l {
89
- width: 224px;
90
- height: 224px;
91
- left: -22px;
92
- top: -22px;
93
- }
94
- }
95
- </style>
@@ -1,80 +0,0 @@
1
- <template>
2
- <div class="w-buff" v-if="data">
3
- <div class="w-buff-wrapper">
4
- <img class="w-buff-icon" :src="iconLink(data.IconID)" :alt="data.Name" />
5
- <div class="w-buff-content">
6
- <span class="w-buff-name">{{data.Name}}</span>
7
- <span class="w-buff-desc">{{data.Desc}}</span>
8
- <span class="w-buff-type" v-if="data.DetachType">※ {{showDetachType(data.DetachType)}}</span>
9
- <span class="w-buff-meta">ID : {{data.BuffID}}</span>
10
- <span class="w-buff-meta">Level : {{data.Level}}</span>
11
- </div>
12
- </div>
13
- </div>
14
- </template>
15
-
16
- <script>
17
- import { getBuff } from "../../../service/database.js";
18
- import * as utilModule from "@jx3box/jx3box-common/js/utils";
19
- const { iconLink } = utilModule;
20
- import detach_types from "../../../assets/data/detach_type.json";
21
- export default {
22
- name: "BuffComponent",
23
- props: ["client", "id", "level"],
24
- data: () => ({
25
- data: null,
26
- }),
27
- computed: {
28
- params: function () {
29
- return [this.client, this.id, this.level];
30
- },
31
- },
32
- watch: {
33
- params: {
34
- immediate: true,
35
- deep: true,
36
- handler(val) {
37
- if (val) {
38
- let [client, id, level] = val;
39
- // 读取本地数据
40
- const cache = sessionStorage.getItem(
41
- `buff-${client}-${id}-${level}`
42
- );
43
- if (cache) {
44
- this.data = JSON.parse(cache);
45
- // 没有缓存则发起请求获取数据
46
- } else {
47
- id &&
48
- getBuff(...this.params).then((res) => {
49
- let data = res.data?.list?.[0];
50
- this.data = data;
51
-
52
- // 将数据放入 sessionStorage
53
- sessionStorage.setItem(
54
- `buff-${client}-${id}-${level}`,
55
- JSON.stringify(data)
56
- );
57
- });
58
- }
59
- }
60
- },
61
- },
62
- },
63
- methods: {
64
- iconLink: function (id) {
65
- return iconLink(id, this.client);
66
- },
67
- showDetachType: function (val) {
68
- if (val && detach_types[val]) {
69
- return detach_types[val];
70
- } else {
71
- return "";
72
- }
73
- },
74
- },
75
- };
76
- </script>
77
-
78
- <style lang="less">
79
- @import "../../../assets/css/module/buff.less";
80
- </style>