@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
@@ -1,19 +1,29 @@
1
1
  <template>
2
2
  <div class="w-boxcoin-user" v-if="allowBoxcoin">
3
- <el-tooltip effect="dark" content="投币" placement="top-start" v-if="canGift">
3
+ <el-tooltip
4
+ effect="dark"
5
+ :content="$jx3boxT('jx3boxUi.boxcoinUser.tooltip', '投币')"
6
+ placement="top-start"
7
+ v-if="canGift"
8
+ >
4
9
  <div class="w-boxcoin-block" @click="openBoxcoinPop">
5
10
  <img class="u-icon" svg-inline :src="iconPath" />
6
11
  <span class="u-count" v-if="boxcoin">{{ boxcoin }}</span>
7
12
  </div>
8
13
  </el-tooltip>
9
- <el-tooltip effect="dark" content="您当前等级不够,不能够进行投币。" placement="top" v-else>
14
+ <el-tooltip
15
+ effect="dark"
16
+ :content="$jx3boxT('jx3boxUi.boxcoinUser.disabledTooltip', '您当前等级不够,不能够进行投币。')"
17
+ placement="top"
18
+ v-else
19
+ >
10
20
  <div class="w-boxcoin-block disabled">
11
21
  <img class="u-icon" svg-inline :src="iconPath" />
12
22
  <span class="u-count" v-if="boxcoin">{{ boxcoin }}</span>
13
23
  </div>
14
24
  </el-tooltip>
15
25
  <el-dialog
16
- title="投币打赏"
26
+ :title="$jx3boxT('jx3boxUi.boxcoinUser.dialogTitle', '投币打赏')"
17
27
  v-model="visible"
18
28
  class="w-boxcoin-pop"
19
29
  append-to-body
@@ -21,34 +31,34 @@
21
31
  >
22
32
  <div class="w-boxcoin-user-content">
23
33
  <div class="u-left">
24
- <em class="u-label">当前拥有盒币</em>
34
+ <em class="u-label">{{ $jx3boxT("jx3boxUi.boxcoinUser.currentBoxcoin", "当前拥有盒币") }}</em>
25
35
  <b>{{ left }}</b>
26
- <a class="u-charge" :href="chargeLink" target="_blank">[充值]</a>
36
+ <a class="u-charge" :href="chargeLink" target="_blank">[{{ $jx3boxT("jx3boxUi.boxcoinUser.recharge", "充值") }}]</a>
27
37
  </div>
28
38
  <div class="u-list">
29
- <em class="u-label">❤️ 打赏</em>
39
+ <em class="u-label">❤️ {{ $jx3boxT("jx3boxUi.boxcoinUser.reward", "打赏") }}</em>
30
40
  <Contributors v-if="authors && authors.length" :authors="authors" @chosen="handleChosen" />
31
41
  <div class="u-points">
32
42
  <el-radio-group v-model="count">
33
43
  <el-radio :value="item" v-for="item in fitPoints" :key="item" border>
34
44
  <b>{{ item }}</b
35
- >盒币
45
+ >{{ $jx3boxT("jx3boxUi.boxcoinUser.boxcoin", "盒币") }}
36
46
  </el-radio>
37
- <el-radio value="custom" border>自定义</el-radio>
47
+ <el-radio value="custom" border>{{ $jx3boxT("jx3boxUi.boxcoinUser.custom", "自定义") }}</el-radio>
38
48
  <el-input
39
49
  v-model="amount"
40
50
  v-show="count === 'custom'"
41
- placeholder="输入自定义数量"
51
+ :placeholder="$jx3boxT('jx3boxUi.boxcoinUser.customPlaceholder', '输入自定义数量')"
42
52
  ></el-input>
43
53
  </el-radio-group>
44
54
  </div>
45
55
  </div>
46
56
  <div class="u-msg">
47
- <em class="u-label">📝 寄语</em>
57
+ <em class="u-label">📝 {{ $jx3boxT("jx3boxUi.boxcoinUser.remark", "寄语") }}</em>
48
58
  <div class="u-input">
49
59
  <el-input
50
60
  v-model="remark"
51
- placeholder="请输入寄语(必填)"
61
+ :placeholder="$jx3boxT('jx3boxUi.boxcoinUser.remarkPlaceholder', '请输入寄语(必填)')"
52
62
  :minlength="2"
53
63
  :maxlength="30"
54
64
  show-word-limit
@@ -58,8 +68,10 @@
58
68
  </div>
59
69
  <template #footer>
60
70
  <span class="dialog-footer">
61
- <el-button @click="visible = false">取 消</el-button>
62
- <el-button type="primary" @click="submit" :disabled="!ready">确 定</el-button>
71
+ <el-button @click="visible = false">{{ $jx3boxT("jx3boxUi.common.cancel", "取消") }}</el-button>
72
+ <el-button type="primary" @click="submit" :disabled="!ready">{{
73
+ $jx3boxT("jx3boxUi.common.confirm", "确定")
74
+ }}</el-button>
63
75
  </span>
64
76
  </template>
65
77
  </el-dialog>
@@ -72,8 +84,10 @@ import User from "@jx3box/jx3box-common/js/user";
72
84
  import Contributors from "./Contributors.vue";
73
85
  import { debounce } from "lodash";
74
86
  import JX3BOX from "@jx3box/jx3box-common/data/jx3box.json";
87
+ import i18nMixin from "../../i18n/mixin";
75
88
  export default {
76
89
  name: "BoxcoinUser",
90
+ mixins: [i18nMixin],
77
91
  props: {
78
92
  boxcoin: {
79
93
  type: Number,
@@ -124,7 +138,7 @@ export default {
124
138
  visible: false,
125
139
 
126
140
  count: 0,
127
- remark: "辛苦了,谢谢大大!",
141
+ remark: this.$jx3boxT("jx3boxUi.boxcoinUser.defaultRemark", "辛苦了,谢谢大大!"),
128
142
  amount: "",
129
143
 
130
144
  left: this.own,
@@ -190,7 +204,7 @@ export default {
190
204
  })
191
205
  .then((res) => {
192
206
  this.$message({
193
- message: "操作成功",
207
+ message: this.$jx3boxT("jx3boxUi.boxcoinUser.success", "操作成功"),
194
208
  type: "success",
195
209
  });
196
210
  return res.data.data;
@@ -216,6 +230,10 @@ export default {
216
230
  .w-boxcoin-user {
217
231
  .dbi;
218
232
  .x(left);
233
+ .w-boxcoin-block {
234
+ .flex;
235
+ align-items: center;
236
+ }
219
237
  .u-icon {
220
238
  .size(26px);
221
239
  .y;
@@ -224,8 +242,6 @@ export default {
224
242
  .u-count {
225
243
  color: #888;
226
244
  .ml(10px);
227
- .pr;
228
- top: 4px;
229
245
  }
230
246
  .u-charge {
231
247
  .underline(@color-link);
@@ -14,8 +14,10 @@
14
14
  import User from "@jx3box/jx3box-common/js/user";
15
15
  import { hasFav, addFav, delFav } from "../../service/fav";
16
16
  import JX3BOX from "@jx3box/jx3box-common/data/jx3box.json";
17
+ import i18nMixin from "../../i18n/mixin";
17
18
  export default {
18
19
  name: "FavoriteComp",
20
+ mixins: [i18nMixin],
19
21
  props: {
20
22
  postType: {
21
23
  type: String,
@@ -47,7 +49,9 @@ export default {
47
49
  },
48
50
  computed: {
49
51
  favContent() {
50
- return this.favorite ? "已收藏" : "收藏";
52
+ return this.favorite
53
+ ? this.$jx3boxT("jx3boxUi.fav.collected", "已收藏")
54
+ : this.$jx3boxT("jx3boxUi.fav.collect", "收藏");
51
55
  },
52
56
  starIcon() {
53
57
  return this.isOld ? require("../../assets/img/widget/star.svg") : JX3BOX.__cdn + "design/vector/icon/collect.svg"
@@ -0,0 +1,317 @@
1
+ <template>
2
+ <div class="w-boxcoin-admin">
3
+ <el-dialog
4
+ :title="dialogTitle"
5
+ v-model="show"
6
+ class="w-boxcoin-pop"
7
+ :close-on-click-modal="false"
8
+ append-to-body
9
+ @close="onClose"
10
+ >
11
+ <div class="w-boxcoin-admin-content">
12
+ <div class="u-left" v-if="type == 'grant'">
13
+ <em class="u-label">本月状态</em>
14
+ 已用<b>{{ this.used }}</b> 剩余<b>{{ this.left }}</b> 总计<b>{{ this.total }}</b>
15
+ <el-progress
16
+ :percentage="this.total ? 100 - (this.used * 100) / this.total : 0"
17
+ :stroke-width="15"
18
+ :text-inside="true"
19
+ ></el-progress>
20
+ </div>
21
+ <div class="u-left" v-else>
22
+ <em class="u-label">当前拥有盒币</em>
23
+ <b>{{ left }}</b>
24
+ <!-- <a class="u-charge" :href="chargeLink" target="_blank">[充值]</a> -->
25
+ </div>
26
+ <el-radio-group class="u-homework-type" v-model="type" size="small" v-if="hasPermission">
27
+ <el-radio-button value="grant">品鉴</el-radio-button>
28
+ <el-radio-button value="reward">打赏</el-radio-button>
29
+ </el-radio-group>
30
+ <div class="u-list">
31
+ <em class="u-label">❤️ {{ type == "reward" ? "打赏" : "品鉴" }}</em>
32
+ <div class="u-points">
33
+ <el-radio-group v-model="count">
34
+ <el-radio :value="item" v-for="item in fitPoints" :key="item" border>
35
+ <b>{{ item }}</b
36
+ >盒币
37
+ </el-radio>
38
+ <el-radio value="custom" border>自定义</el-radio>
39
+ <el-input
40
+ v-model="amount"
41
+ v-show="count === 'custom'"
42
+ placeholder="输入自定义数量"
43
+ ></el-input>
44
+ </el-radio-group>
45
+ </div>
46
+ </div>
47
+ <div class="u-msg">
48
+ <em class="u-label">📝 寄语</em>
49
+ <div class="u-input">
50
+ <el-input
51
+ v-model="remark"
52
+ placeholder="请输入寄语(必填)"
53
+ :minlength="2"
54
+ :maxlength="30"
55
+ show-word-limit
56
+ ></el-input>
57
+ <el-button :disabled="fetchingCurrentRelease" @click="insertCurrentRelease"
58
+ >插入当前版本</el-button
59
+ >
60
+ </div>
61
+ </div>
62
+ </div>
63
+ <template #footer>
64
+ <el-button @click="onClose">取 消</el-button>
65
+ <el-button type="primary" @click="submit" :disabled="!ready || submitting">确 定</el-button>
66
+ </template>
67
+ </el-dialog>
68
+ </div>
69
+ </template>
70
+
71
+ <script>
72
+ import { grantBoxcoin, getPostBoxcoinConfig, getBoxcoinStatus, rewardBoxcoin } from "../../service/thx.js";
73
+ import User from "@jx3box/jx3box-common/js/user";
74
+ import { getBreadcrumb } from "@jx3box/jx3box-common/js/system";
75
+ export default {
76
+ name: "Homework",
77
+ props: {
78
+ postType: {
79
+ type: String,
80
+ default: "",
81
+ },
82
+ postId: {
83
+ type: [String, Number],
84
+ default: 0,
85
+ },
86
+ userId: {
87
+ type: [String, Number],
88
+ default: 0,
89
+ },
90
+ client: {
91
+ type: String,
92
+ default: "",
93
+ },
94
+ modelValue: {
95
+ type: Boolean,
96
+ default: false,
97
+ },
98
+ articleId: {
99
+ type: [String, Number],
100
+ default: 0,
101
+ },
102
+ category: {
103
+ type: String,
104
+ default: "",
105
+ },
106
+ title: {
107
+ type: String,
108
+ default: "",
109
+ },
110
+ placeholder: {
111
+ type: String,
112
+ default: "",
113
+ },
114
+ },
115
+ emits: ["update:modelValue", "updateRecord"],
116
+ data: function () {
117
+ return {
118
+ count: 0,
119
+
120
+ remark: "不错,加油!",
121
+ chosen: "", // 被选中的人
122
+ amount: "",
123
+
124
+ submitting: false,
125
+ fetchingCurrentRelease: false,
126
+
127
+ // 打赏or品鉴
128
+ type: "reward",
129
+
130
+ // config
131
+ admin_max: 0,
132
+ admin_min: 0,
133
+ admin_left: 0,
134
+ admin_total: 0,
135
+ admin_points: [100],
136
+
137
+ user_left: 0,
138
+ user_points: [100],
139
+ boxcoin_enable: false,
140
+
141
+ show: false,
142
+ };
143
+ },
144
+ computed: {
145
+ left() {
146
+ return this.type === "reward" ? this.user_left : this.admin_left;
147
+ },
148
+ hasPermission() {
149
+ return User.hasPermission("manage_bbs_reward");
150
+ },
151
+ total: function () {
152
+ return this.admin_total;
153
+ },
154
+ used: function () {
155
+ return this.total - this.left;
156
+ },
157
+ ready: function () {
158
+ const count = this.count === "custom" ? this.amount : this.count;
159
+ // 不能给自己打赏,打赏目标不能是自己
160
+ // 打赏数量不能超过剩余数量
161
+ // 打赏数量不能为0
162
+ // 打赏寄语不能为空
163
+ return !!(!this.isSelf && !this.targetIsSelf && this.isEnough && count && this.remark);
164
+ },
165
+ isNotSelf: function () {
166
+ return this.userId != User.getInfo().uid;
167
+ },
168
+ targetIsSelf: function () {
169
+ return this.chosen == User.getInfo().uid;
170
+ },
171
+ isEnough: function () {
172
+ const count = this.count === "custom" ? this.amount : this.count;
173
+ return this.left && this.left >= count;
174
+ },
175
+ allowBoxcoin: function () {
176
+ return this.postType && this.postId && (this.userId || (this.authors && this.authors.length));
177
+ },
178
+ hostClient: function () {
179
+ return location.href.includes("origin") ? "origin" : "std";
180
+ },
181
+ points: function () {
182
+ return this.type === "reward" ? this.user_points : this.admin_points;
183
+ },
184
+ fitPoints: function () {
185
+ const points = this.points.filter((item) => item <= this.left);
186
+ if (this.isSignAuthor) {
187
+ // 最大值为1000
188
+ return points.filter((item) => item <= 1000);
189
+ }
190
+ return points;
191
+ },
192
+ isSignAuthor: function () {
193
+ return User.getInfo().group == 32;
194
+ },
195
+ finalClient: function () {
196
+ if (this.client == "wujie") {
197
+ return "std";
198
+ }
199
+ return this.client;
200
+ },
201
+ dialogTitle() {
202
+ return this.title || "批改作业";
203
+ },
204
+ },
205
+ watch: {
206
+ own: function (val) {
207
+ this.left = val;
208
+ },
209
+ modelValue: function (val) {
210
+ if (val) {
211
+ this.show = true;
212
+ this.loadBoxcoinConfig();
213
+
214
+ if (this.hasPermission) {
215
+ this.type = "grant";
216
+ }
217
+ }
218
+ },
219
+ show: function (val) {
220
+ this.$emit("update:modelValue", val);
221
+ },
222
+ },
223
+ methods: {
224
+ // 选择要打赏的对象
225
+ handleChosen(userId) {
226
+ this.chosen = userId;
227
+ },
228
+ submit: function () {
229
+ this.submitting = true;
230
+ const count = this.count === "custom" ? this.amount : this.count;
231
+ let client = this.client || this.hostClient;
232
+ if (!["std", "origin", "all"].includes(client)) {
233
+ client = "std";
234
+ }
235
+ const fn = this.type === "reward" ? rewardBoxcoin : grantBoxcoin;
236
+ fn(this.postType, this.postId, this.userId, count, {
237
+ remark: this.remark,
238
+ client: client,
239
+ redirect: `/${this.category}/${this.articleId}`,
240
+ })
241
+ .then((res) => {
242
+ this.$message({
243
+ message: "操作成功",
244
+ type: "success",
245
+ });
246
+ return res.data.data;
247
+ })
248
+ .then((data) => {
249
+ // 1.扣除额度
250
+ this.left -= this.count;
251
+ // 2.将修改emit出去
252
+ this.$emit("updateRecord", data);
253
+ })
254
+ .finally(() => {
255
+ this.submitting = false;
256
+ this.onClose();
257
+ });
258
+ },
259
+ insertCurrentRelease: function () {
260
+ this.fetchingCurrentRelease = true;
261
+ getBreadcrumb(`current-release-${this.hostClient}`)
262
+ .then((res) => {
263
+ this.remark += res;
264
+ })
265
+ .catch((err) => {
266
+ this.$message({
267
+ message: "获取失败",
268
+ type: "error",
269
+ });
270
+ })
271
+ .finally(() => {
272
+ this.fetchingCurrentRelease = false;
273
+ });
274
+ },
275
+ loadBoxcoinConfig: function () {
276
+ User.isLogin() &&
277
+ getPostBoxcoinConfig(this.postType).then((res) => {
278
+ this.admin_max = res.data.data.limit.admin_max || 0;
279
+ this.admin_min = res.data.data.limit.admin_min || 0;
280
+ this.admin_points = res.data.data.limit.admin_points || [10, 1000];
281
+ this.admin_left = res.data.data.asManagerBoxCoinRemain || 0;
282
+ this.admin_total = res.data.data.asManagerBoxCoinTotal || 0;
283
+
284
+ this.user_points = res.data.data.limit.user_points || [10, 1000];
285
+ // 根据多端展示剩余币
286
+ // 作品是n端,接受n端币+all币
287
+ if (this.finalClient == "origin") {
288
+ this.user_left = res.data.data.asUserBoxCoinRemainOrigin + res.data.data.asUserBoxCoinRemainAll;
289
+ } else if (this.finalClient == "std") {
290
+ this.user_left = res.data.data.asUserBoxCoinRemainStd + res.data.data.asUserBoxCoinRemainAll;
291
+ } else {
292
+ this.user_left =
293
+ res.data.data.asUserBoxCoinRemainAll +
294
+ res.data.data.asUserBoxCoinRemainStd +
295
+ res.data.data.asUserBoxCoinRemainOrigin;
296
+ }
297
+ });
298
+ getBoxcoinStatus().then((res) => {
299
+ this.boxcoin_enable = !!~~res.data?.data?.val;
300
+ });
301
+ },
302
+ onClose() {
303
+ this.show = false;
304
+ },
305
+ },
306
+ mounted() {
307
+ this.remark = this.placeholder || "不错,加油!";
308
+ },
309
+ };
310
+ </script>
311
+
312
+ <style lang="less">
313
+ @import "../../assets/css/single/thx.less";
314
+ .u-homework-type {
315
+ margin-top: 10px;
316
+ }
317
+ </style>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="w-like2" :class="{ disabled: !status }" @click="addLike" v-if="ready">
3
- <el-tooltip effect="dark" content="点赞" placement="top-start">
4
- <div>
3
+ <el-tooltip effect="dark" :content="$jx3boxT('jx3boxUi.like.like', '点赞')" placement="top-start">
4
+ <div class="w-like2__trigger">
5
5
  <img class="u-icon" svg-inline :src="iconPath" />
6
6
  <span class="u-count" v-if="count">{{ count }}</span>
7
7
  </div>
@@ -12,8 +12,10 @@
12
12
  <script>
13
13
  import { postStat, getStat } from "@jx3box/jx3box-common/js/stat";
14
14
  import JX3BOX from "@jx3box/jx3box-common/data/jx3box.json";
15
+ import i18nMixin from "../../i18n/mixin";
15
16
  export default {
16
17
  name: "LikeComp",
18
+ mixins: [i18nMixin],
17
19
  props: {
18
20
  postType: {
19
21
  type: String,
@@ -0,0 +1,104 @@
1
+ <template>
2
+ <div ref="trigger" class="w-qrcode" @click="togglePic" v-if="mode == 'cms'">
3
+ <img class="u-icon" svg-inline src="../../assets/img/widget/qr-code.svg" />
4
+ <span class="u-text">二维码</span>
5
+ </div>
6
+ <teleport to="body">
7
+ <div v-if="mode == 'cms' && active" class="u-qrcode u-qrcode-popup" :style="popupStyle" @click.stop>
8
+ <qrcode-vue class="u-pic" :value="value" :size="size" level="H"></qrcode-vue>
9
+ <span>扫一扫即可访问</span>
10
+ </div>
11
+ </teleport>
12
+ <div class="w-qrcode-static" v-if="mode == 'static'">
13
+ <div class="u-qrcode">
14
+ <qrcode-vue class="u-pic" :value="value" :size="size" level="H"></qrcode-vue>
15
+ <span class="u-txt"
16
+ ><img class="u-icon" svg-inline src="../../assets/img/widget/qr-code.svg" />扫一扫手机访问</span
17
+ >
18
+ </div>
19
+ </div>
20
+ </template>
21
+
22
+ <script>
23
+ import { nextTick } from "vue";
24
+ import QrcodeVue from "qrcode.vue";
25
+ export default {
26
+ name: "QRcode",
27
+ props: {
28
+ href: {
29
+ type: String,
30
+ default: "",
31
+ },
32
+ v: {
33
+ type: String,
34
+ default: "cms",
35
+ },
36
+ s: {
37
+ type: Number,
38
+ default: 100,
39
+ },
40
+ },
41
+ data: function () {
42
+ return {
43
+ value: this.href || location.href,
44
+ size: this.s || 100,
45
+ active: false,
46
+ mode: this.v || "cms",
47
+ popupStyle: {
48
+ top: "0px",
49
+ left: "0px",
50
+ },
51
+ docClickHandler: null,
52
+ repositionHandler: null,
53
+ };
54
+ },
55
+ computed: {},
56
+ methods: {
57
+ togglePic: function (e) {
58
+ e.stopPropagation();
59
+ this.active = !this.active;
60
+ if (this.active) {
61
+ nextTick(() => {
62
+ this.updatePopupPosition();
63
+ });
64
+ }
65
+ },
66
+ updatePopupPosition: function () {
67
+ const trigger = this.$refs.trigger;
68
+ if (!trigger) return;
69
+
70
+ const rect = trigger.getBoundingClientRect();
71
+ this.popupStyle = {
72
+ top: `${rect.bottom + 5}px`,
73
+ left: `${rect.left + rect.width / 2}px`,
74
+ };
75
+ },
76
+ },
77
+ mounted: function () {
78
+ this.docClickHandler = () => {
79
+ this.active = false;
80
+ };
81
+ this.repositionHandler = () => {
82
+ if (this.active) {
83
+ this.updatePopupPosition();
84
+ }
85
+ };
86
+
87
+ document.addEventListener("click", this.docClickHandler);
88
+ window.addEventListener("resize", this.repositionHandler);
89
+ window.addEventListener("scroll", this.repositionHandler, true);
90
+ },
91
+ beforeUnmount: function () {
92
+ document.removeEventListener("click", this.docClickHandler);
93
+ window.removeEventListener("resize", this.repositionHandler);
94
+ window.removeEventListener("scroll", this.repositionHandler, true);
95
+ },
96
+ components: {
97
+ QrcodeVue,
98
+ },
99
+ };
100
+ </script>
101
+
102
+ <style lang="less">
103
+ @import "../../assets/css/interact/qrcode.less";
104
+ </style>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="w-rss">
3
3
  <el-tooltip effect="dark" :content="tooltipContent" placement="top-start">
4
- <div @click="onRssClick">
4
+ <div class="w-rss__trigger" @click="onRssClick">
5
5
  <img v-if="subscribed" class="u-icon" svg-inline :src="rmSrc" />
6
6
  <img v-else class="u-icon" svg-inline :src="addSrc" />
7
7
  <span class="u-count" v-if="!hiddenNum && total > 0">{{ total }}</span>
@@ -24,9 +24,11 @@ import {
24
24
  unsubscribePost,
25
25
  } from "@jx3box/jx3box-common/js/rss";
26
26
  const jx3box = require("@jx3box/jx3box-common/data/jx3box.json");
27
+ import i18nMixin from "../../i18n/mixin";
27
28
 
28
29
  export default {
29
30
  name: "RssComponent",
31
+ mixins: [i18nMixin],
30
32
  props: {
31
33
  type: {
32
34
  type: String,
@@ -53,7 +55,9 @@ export default {
53
55
  },
54
56
  computed: {
55
57
  tooltipContent() {
56
- return this.subscribed ? "已订阅" : "加入订阅";
58
+ return this.subscribed
59
+ ? this.$jx3boxT("jx3boxUi.rss.subscribed", "已订阅")
60
+ : this.$jx3boxT("jx3boxUi.rss.subscribe", "加入订阅");
57
61
  },
58
62
  addSrc() {
59
63
  return jx3box.__cdn + "design/vector/icon/rss.svg";
@@ -153,11 +157,13 @@ export default {
153
157
  .y;
154
158
  .pr;
155
159
  }
160
+ .w-rss__trigger {
161
+ .flex;
162
+ align-items: center;
163
+ }
156
164
  .u-count {
157
165
  color: #888;
158
166
  .ml(10px);
159
- top: 2px;
160
- .pr;
161
167
  }
162
168
  }
163
169
  </style>