@jx3box/jx3box-ui 0.0.1

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 (408) hide show
  1. package/.env +6 -0
  2. package/README.md +4 -0
  3. package/assets/css/bread/admin.less +131 -0
  4. package/assets/css/bread/breadcrumb.less +163 -0
  5. package/assets/css/bread/crumb.less +17 -0
  6. package/assets/css/comment/quick-reply.less +56 -0
  7. package/assets/css/common/bottom.less +21 -0
  8. package/assets/css/common/footer.less +78 -0
  9. package/assets/css/common/left-sidebar.less +137 -0
  10. package/assets/css/common/main.less +75 -0
  11. package/assets/css/common/right-sidebar.less +193 -0
  12. package/assets/css/common/suspend-common.less +343 -0
  13. package/assets/css/editor/article.less +36 -0
  14. package/assets/css/editor/combo.less +311 -0
  15. package/assets/css/editor/resource.less +335 -0
  16. package/assets/css/editor/tinymce.less +80 -0
  17. package/assets/css/editor/upload.less +111 -0
  18. package/assets/css/filters/client-by.less +33 -0
  19. package/assets/css/header/box.less +181 -0
  20. package/assets/css/interact/like2.less +20 -0
  21. package/assets/css/interact/share2.less +101 -0
  22. package/assets/css/mixin.less +64 -0
  23. package/assets/css/module/author.less +190 -0
  24. package/assets/css/module/buff.less +78 -0
  25. package/assets/css/module/directory.less +143 -0
  26. package/assets/css/module/icon.less +21 -0
  27. package/assets/css/module/item.less +229 -0
  28. package/assets/css/module/item_simple.less +51 -0
  29. package/assets/css/module/jx3_element.less +4 -0
  30. package/assets/css/module/macro.less +72 -0
  31. package/assets/css/module/npc.less +220 -0
  32. package/assets/css/module/resource.less +80 -0
  33. package/assets/css/module/skill.less +65 -0
  34. package/assets/css/module/talent.less +424 -0
  35. package/assets/css/single/author.less +101 -0
  36. package/assets/css/single/cms-single.less +55 -0
  37. package/assets/css/single/thx.less +230 -0
  38. package/assets/css/tinymce/_.less +28 -0
  39. package/assets/css/tinymce/a.less +29 -0
  40. package/assets/css/tinymce/code.less +159 -0
  41. package/assets/css/tinymce/combo.less +86 -0
  42. package/assets/css/tinymce/fold.less +70 -0
  43. package/assets/css/tinymce/h.less +58 -0
  44. package/assets/css/tinymce/hr.less +9 -0
  45. package/assets/css/tinymce/img.less +16 -0
  46. package/assets/css/tinymce/imgpreview.less +14 -0
  47. package/assets/css/tinymce/latex.less +43 -0
  48. package/assets/css/tinymce/list.less +65 -0
  49. package/assets/css/tinymce/macro.less +40 -0
  50. package/assets/css/tinymce/nextpage.less +65 -0
  51. package/assets/css/tinymce/p.less +8 -0
  52. package/assets/css/tinymce/plugin.less +3 -0
  53. package/assets/css/tinymce/pz.less +39 -0
  54. package/assets/css/tinymce/qixue.less +39 -0
  55. package/assets/css/tinymce/quote.less +12 -0
  56. package/assets/css/tinymce/table.less +59 -0
  57. package/assets/css/tinymce/video.less +61 -0
  58. package/assets/css/var.less +1 -0
  59. package/assets/data/box.json +184 -0
  60. package/assets/data/box2.json +606 -0
  61. package/assets/data/detach_type.json +29 -0
  62. package/assets/data/game_font.json +242 -0
  63. package/assets/data/nav.json +12 -0
  64. package/assets/data/panel.json +27 -0
  65. package/assets/data/reply_template.json +6 -0
  66. package/assets/data/weapon_type.json +20 -0
  67. package/assets/data/zlp.json +5 -0
  68. package/assets/img/author/bilibili.png +0 -0
  69. package/assets/img/author/bilibili.svg +1 -0
  70. package/assets/img/author/chat.png +0 -0
  71. package/assets/img/author/douyu.png +0 -0
  72. package/assets/img/author/douyu.svg +1 -0
  73. package/assets/img/author/github.svg +1 -0
  74. package/assets/img/author/huya.png +0 -0
  75. package/assets/img/author/huya.svg +1 -0
  76. package/assets/img/author/msg.svg +55 -0
  77. package/assets/img/author/tuilan.png +0 -0
  78. package/assets/img/author/weibo.svg +70 -0
  79. package/assets/img/bread/menu.svg +1 -0
  80. package/assets/img/comment/comment.svg +1 -0
  81. package/assets/img/comment/heart_1.svg +1 -0
  82. package/assets/img/comment/heart_2.svg +1 -0
  83. package/assets/img/comment/hide.svg +1 -0
  84. package/assets/img/common/add.svg +1 -0
  85. package/assets/img/common/android.svg +1 -0
  86. package/assets/img/common/bell.svg +1 -0
  87. package/assets/img/common/bilibili-black.svg +1 -0
  88. package/assets/img/common/bilibili.svg +1 -0
  89. package/assets/img/common/check.svg +1 -0
  90. package/assets/img/common/coin.svg +1 -0
  91. package/assets/img/common/coupon.svg +56 -0
  92. package/assets/img/common/douyin.svg +1 -0
  93. package/assets/img/common/edit.svg +1 -0
  94. package/assets/img/common/followus.svg +18 -0
  95. package/assets/img/common/gift.svg +1 -0
  96. package/assets/img/common/harmony.svg +1 -0
  97. package/assets/img/common/ios.svg +1 -0
  98. package/assets/img/common/jx3-origin.svg +15 -0
  99. package/assets/img/common/jx3-www.svg +9 -0
  100. package/assets/img/common/lang.svg +6 -0
  101. package/assets/img/common/logo.svg +5 -0
  102. package/assets/img/common/manage.svg +1 -0
  103. package/assets/img/common/miniprogram.jpg +0 -0
  104. package/assets/img/common/miniprogram.svg +1 -0
  105. package/assets/img/common/mp.jpg +0 -0
  106. package/assets/img/common/msg.svg +1 -0
  107. package/assets/img/common/news.svg +20 -0
  108. package/assets/img/common/qqbot.svg +7 -0
  109. package/assets/img/common/qrcode.svg +1 -0
  110. package/assets/img/common/search-key-slash.svg +5 -0
  111. package/assets/img/common/send.svg +56 -0
  112. package/assets/img/common/setting.svg +1 -0
  113. package/assets/img/common/vip.svg +1 -0
  114. package/assets/img/common/wechat.svg +48 -0
  115. package/assets/img/common/weibo.svg +70 -0
  116. package/assets/img/editor/buff.svg +1 -0
  117. package/assets/img/editor/file.svg +51 -0
  118. package/assets/img/editor/icons.svg +15 -0
  119. package/assets/img/editor/item.svg +46 -0
  120. package/assets/img/editor/jx3.svg +11 -0
  121. package/assets/img/editor/jx3box.svg +5 -0
  122. package/assets/img/editor/skill.svg +53 -0
  123. package/assets/img/editor/view.svg +1 -0
  124. package/assets/img/footer/android.svg +1 -0
  125. package/assets/img/footer/china.svg +1 -0
  126. package/assets/img/footer/harmony.svg +1 -0
  127. package/assets/img/footer/ios.svg +1 -0
  128. package/assets/img/footer/logo.svg +5 -0
  129. package/assets/img/footer/miniprogram.svg +1 -0
  130. package/assets/img/footer/qqbot.svg +7 -0
  131. package/assets/img/header/add.svg +1 -0
  132. package/assets/img/header/bell.svg +1 -0
  133. package/assets/img/header/check.svg +1 -0
  134. package/assets/img/header/coin.svg +1 -0
  135. package/assets/img/header/edit.svg +1 -0
  136. package/assets/img/header/gift.svg +1 -0
  137. package/assets/img/header/logo.svg +5 -0
  138. package/assets/img/header/manage.svg +1 -0
  139. package/assets/img/header/msg.svg +1 -0
  140. package/assets/img/header/search-key-slash.svg +5 -0
  141. package/assets/img/header/send.svg +56 -0
  142. package/assets/img/header/setting.svg +1 -0
  143. package/assets/img/header/translator.svg +1 -0
  144. package/assets/img/header/vip.svg +1 -0
  145. package/assets/img/leftsidebar/arrow.svg +64 -0
  146. package/assets/img/leftsidebar/close.svg +49 -0
  147. package/assets/img/leftsidebar/fans.svg +1 -0
  148. package/assets/img/leftsidebar/medal.svg +1 -0
  149. package/assets/img/leftsidebar/more.svg +50 -0
  150. package/assets/img/leftsidebar/open.svg +51 -0
  151. package/assets/img/leftsidebar/post.svg +46 -0
  152. package/assets/img/leftsidebar/team.svg +1 -0
  153. package/assets/img/leftsidebar/united.svg +1 -0
  154. package/assets/img/list/post.svg +1 -0
  155. package/assets/img/mobile/miniprogram.jpg +0 -0
  156. package/assets/img/mobile/mp.jpg +0 -0
  157. package/assets/img/npc/attack.svg +69 -0
  158. package/assets/img/npc/buff.svg +20 -0
  159. package/assets/img/npc/energy.svg +1 -0
  160. package/assets/img/npc/miss.svg +1 -0
  161. package/assets/img/npc/npc.svg +1 -0
  162. package/assets/img/npc/radar.svg +45 -0
  163. package/assets/img/npc/shield.svg +1 -0
  164. package/assets/img/npc/sight.svg +1 -0
  165. package/assets/img/npc/skull.svg +15 -0
  166. package/assets/img/npc/target.svg +55 -0
  167. package/assets/img/price/jin.png +0 -0
  168. package/assets/img/price/tong.png +0 -0
  169. package/assets/img/price/yin.png +0 -0
  170. package/assets/img/price/zhuan.png +0 -0
  171. package/assets/img/rightsidebar/ac.svg +1 -0
  172. package/assets/img/rightsidebar/github.svg +1 -0
  173. package/assets/img/rightsidebar/repo.svg +1 -0
  174. package/assets/img/rightsidebar/topic_bg.svg +1 -0
  175. package/assets/img/rightsidebar/topic_bg_bps.svg +113 -0
  176. package/assets/img/single/author.svg +1 -0
  177. package/assets/img/single/directory-header.svg +1 -0
  178. package/assets/img/single/lock.svg +1 -0
  179. package/assets/img/single/modate.svg +24 -0
  180. package/assets/img/single/podate.svg +23 -0
  181. package/assets/img/single/ticket.svg +1 -0
  182. package/assets/img/suspend/ArrowsLeftRight.svg +1 -0
  183. package/assets/img/suspend/circle.svg +7 -0
  184. package/assets/img/suspend/collect.svg +1 -0
  185. package/assets/img/suspend/collect_slash.svg +1 -0
  186. package/assets/img/suspend/collect_slash_touchbar.svg +1 -0
  187. package/assets/img/suspend/collect_slash_touchbar_100.svg +1 -0
  188. package/assets/img/suspend/collect_touchbar.svg +1 -0
  189. package/assets/img/suspend/collect_touchbar_100.svg +1 -0
  190. package/assets/img/suspend/lafter_touchbar.svg +1 -0
  191. package/assets/img/suspend/later-on.svg +1 -0
  192. package/assets/img/suspend/line.svg +3 -0
  193. package/assets/img/suspend/more.svg +1 -0
  194. package/assets/img/suspend/pin_slash_24.svg +1 -0
  195. package/assets/img/suspend/pin_slash_touchbar.svg +1 -0
  196. package/assets/img/suspend/pin_slash_touchbar_24.svg +1 -0
  197. package/assets/img/suspend/pin_slash_touchbar_40.svg +1 -0
  198. package/assets/img/suspend/pin_touchbar.svg +1 -0
  199. package/assets/img/suspend/pin_touchbar_100.svg +1 -0
  200. package/assets/img/suspend/pin_touchbar_24.svg +1 -0
  201. package/assets/img/suspend/report_100.svg +1 -0
  202. package/assets/img/suspend/rss_touchbar.svg +1 -0
  203. package/assets/img/suspend/rss_touchbar_100.svg +1 -0
  204. package/assets/img/suspend/search.svg +3 -0
  205. package/assets/img/suspend/search_touchbar.svg +1 -0
  206. package/assets/img/widget/admin_gift.svg +10 -0
  207. package/assets/img/widget/gift.svg +1 -0
  208. package/assets/img/widget/heart.svg +17 -0
  209. package/assets/img/widget/heart1.svg +1 -0
  210. package/assets/img/widget/heart2.svg +11 -0
  211. package/assets/img/widget/heart3.svg +37 -0
  212. package/assets/img/widget/like.svg +1 -0
  213. package/assets/img/widget/like2.svg +1 -0
  214. package/assets/img/widget/like3.svg +14 -0
  215. package/assets/img/widget/like4.png +0 -0
  216. package/assets/img/widget/like4ing.gif +0 -0
  217. package/assets/img/widget/qq.svg +1 -0
  218. package/assets/img/widget/qr-code.svg +1 -0
  219. package/assets/img/widget/qzone.svg +1 -0
  220. package/assets/img/widget/records.svg +1 -0
  221. package/assets/img/widget/share-link.png +0 -0
  222. package/assets/img/widget/share.svg +13 -0
  223. package/assets/img/widget/share2.svg +19 -0
  224. package/assets/img/widget/star.svg +9 -0
  225. package/assets/img/widget/tieba.svg +1 -0
  226. package/assets/img/widget/unstar.svg +21 -0
  227. package/assets/img/widget/web_heart_animation.png +0 -0
  228. package/assets/img/widget/weibo.svg +1 -0
  229. package/assets/img/widget/weixin.svg +1 -0
  230. package/assets/js/a.js +46 -0
  231. package/assets/js/app.js +7 -0
  232. package/assets/js/code.js +13 -0
  233. package/assets/js/combo.js +40 -0
  234. package/assets/js/directory.js +114 -0
  235. package/assets/js/filter2.js +186 -0
  236. package/assets/js/fold.js +11 -0
  237. package/assets/js/gallery.js +14 -0
  238. package/assets/js/hljs_languages.js +177 -0
  239. package/assets/js/iframe.js +38 -0
  240. package/assets/js/img.js +23 -0
  241. package/assets/js/item/attribute_percent.js +88 -0
  242. package/assets/js/item/bind.js +18 -0
  243. package/assets/js/item/border.js +19 -0
  244. package/assets/js/item/border_quest.js +12 -0
  245. package/assets/js/item/color.js +25 -0
  246. package/assets/js/item/hljs_languages.js +177 -0
  247. package/assets/js/item/icon_url.js +15 -0
  248. package/assets/js/item/second_format.js +19 -0
  249. package/assets/js/jx3_element.js +73 -0
  250. package/assets/js/katex.js +181 -0
  251. package/assets/js/macro.js +16 -0
  252. package/assets/js/nextpage.js +4 -0
  253. package/assets/js/pswp.js +67 -0
  254. package/assets/js/pswp_template.js +66 -0
  255. package/assets/js/pz_iframe.js +30 -0
  256. package/assets/js/qixue.js +28 -0
  257. package/assets/js/renderImgPreview.js +18 -0
  258. package/assets/js/script.js +6 -0
  259. package/assets/js/stat.js +107 -0
  260. package/assets/js/talent2.js +21 -0
  261. package/assets/js/tex-mml-chtml.js +36310 -0
  262. package/assets/js/voice.js +238 -0
  263. package/assets/js/xss.js +130 -0
  264. package/babel.config.js +3 -0
  265. package/docs/README.md +78 -0
  266. package/i18n/index.js +134 -0
  267. package/i18n/messages/en-US.js +124 -0
  268. package/i18n/messages/vi.js +124 -0
  269. package/i18n/messages/zh-CN.js +124 -0
  270. package/i18n/messages/zh-TW.js +124 -0
  271. package/i18n/mixin.js +23 -0
  272. package/index.js +73 -0
  273. package/package.json +97 -0
  274. package/postcss.config.js +3 -0
  275. package/service/admin.js +20 -0
  276. package/service/author.js +94 -0
  277. package/service/breadcrumb.js +13 -0
  278. package/service/cms.js +137 -0
  279. package/service/comment.js +187 -0
  280. package/service/database.js +115 -0
  281. package/service/design.js +13 -0
  282. package/service/enum/CollectionPublic.js +13 -0
  283. package/service/enum/EquipPosition.js +48 -0
  284. package/service/enum/EquipType.js +33 -0
  285. package/service/fav.js +27 -0
  286. package/service/follow.js +55 -0
  287. package/service/github.js +15 -0
  288. package/service/header.js +42 -0
  289. package/service/item.js +22 -0
  290. package/service/resource.js +31 -0
  291. package/service/suspend.js +81 -0
  292. package/service/thx.js +60 -0
  293. package/src/App.vue +212 -0
  294. package/src/Bottom.vue +23 -0
  295. package/src/Box.vue +149 -0
  296. package/src/Breadcrumb.vue +141 -0
  297. package/src/CommonFooter.vue +69 -0
  298. package/src/CommonHeader.vue +270 -0
  299. package/src/Footer.vue +45 -0
  300. package/src/LeftSideToggle.vue +64 -0
  301. package/src/LeftSidebar.vue +123 -0
  302. package/src/Main.vue +48 -0
  303. package/src/RightSidebar.vue +61 -0
  304. package/src/SuspendCommon.vue +705 -0
  305. package/src/author/AuthorFans.vue +170 -0
  306. package/src/author/AuthorFollow.vue +205 -0
  307. package/src/author/AuthorGift.vue +286 -0
  308. package/src/author/AuthorHonor.vue +128 -0
  309. package/src/author/AuthorInfo.vue +245 -0
  310. package/src/author/AuthorLink.vue +113 -0
  311. package/src/author/AuthorMedals.vue +87 -0
  312. package/src/author/AuthorMsg.vue +25 -0
  313. package/src/author/AuthorPosts.vue +114 -0
  314. package/src/author/AuthorRss.vue +160 -0
  315. package/src/author/AuthorTeams.vue +106 -0
  316. package/src/author/Avatar.vue +168 -0
  317. package/src/author/UserPop.vue +198 -0
  318. package/src/bread/Admin.vue +400 -0
  319. package/src/bread/AdminButton.vue +31 -0
  320. package/src/bread/AdminDirectMessage.vue +73 -0
  321. package/src/bread/AdminDrop.vue +155 -0
  322. package/src/bread/Crumb.vue +27 -0
  323. package/src/bread/DesignTask.vue +194 -0
  324. package/src/comment/Avatar.vue +124 -0
  325. package/src/comment/CommentContent.vue +486 -0
  326. package/src/comment/CommentContentSimple.vue +240 -0
  327. package/src/comment/CommentInputForm.vue +182 -0
  328. package/src/comment/CommentWithReply.vue +261 -0
  329. package/src/comment/QuickReply.vue +64 -0
  330. package/src/comment/ReplyForReply.vue +127 -0
  331. package/src/comment/ReplyItem.vue +92 -0
  332. package/src/comment/ReplyList.vue +126 -0
  333. package/src/comment/Upload.vue +108 -0
  334. package/src/editor/Article.vue +230 -0
  335. package/src/editor/BoxResource.vue +441 -0
  336. package/src/editor/Resource.vue +623 -0
  337. package/src/editor/Tinymce.vue +204 -0
  338. package/src/editor/Upload.vue +277 -0
  339. package/src/editor/UploadAlum.vue +176 -0
  340. package/src/editor/UploadBanner.vue +156 -0
  341. package/src/editor/components/Author.vue +322 -0
  342. package/src/editor/components/Avatar.vue +95 -0
  343. package/src/editor/components/Buff.vue +80 -0
  344. package/src/editor/components/Combo.vue +259 -0
  345. package/src/editor/components/Equip.vue +299 -0
  346. package/src/editor/components/GameText.vue +242 -0
  347. package/src/editor/components/Item.vue +325 -0
  348. package/src/editor/components/ItemSimple.vue +134 -0
  349. package/src/editor/components/Medal.vue +43 -0
  350. package/src/editor/components/Npc.vue +215 -0
  351. package/src/editor/components/PostAuthor.vue +102 -0
  352. package/src/editor/components/Skill.vue +71 -0
  353. package/src/filters/clientBy.vue +96 -0
  354. package/src/filters/markBy.vue +177 -0
  355. package/src/filters/menuBy.vue +63 -0
  356. package/src/filters/orderBy.vue +170 -0
  357. package/src/filters/tagBy.vue +171 -0
  358. package/src/filters/topicBy.vue +151 -0
  359. package/src/filters/versionBy.vue +49 -0
  360. package/src/filters/zlpBy.vue +70 -0
  361. package/src/footer/copyright.vue +59 -0
  362. package/src/footer/links.vue +79 -0
  363. package/src/footer/official.vue +142 -0
  364. package/src/footer/resource.vue +146 -0
  365. package/src/header/alternate.vue +299 -0
  366. package/src/header/asset.vue +180 -0
  367. package/src/header/box.vue +161 -0
  368. package/src/header/box2.vue +479 -0
  369. package/src/header/bus.js +9 -0
  370. package/src/header/client.vue +183 -0
  371. package/src/header/lang.vue +136 -0
  372. package/src/header/logo.vue +95 -0
  373. package/src/header/manage.vue +200 -0
  374. package/src/header/message.vue +93 -0
  375. package/src/header/nav.vue +356 -0
  376. package/src/header/publish.vue +38 -0
  377. package/src/header/search.vue +120 -0
  378. package/src/header/search_map.json +3 -0
  379. package/src/header/shop.vue +121 -0
  380. package/src/header/user.vue +250 -0
  381. package/src/header/userInfo.vue +621 -0
  382. package/src/header/utils.js +126 -0
  383. package/src/header/vip.vue +120 -0
  384. package/src/interact/BoxcoinAdmin.vue +185 -0
  385. package/src/interact/BoxcoinRecords.vue +153 -0
  386. package/src/interact/BoxcoinUser.vue +194 -0
  387. package/src/interact/Contributors.vue +111 -0
  388. package/src/interact/Fav.vue +95 -0
  389. package/src/interact/Like.vue +61 -0
  390. package/src/interact/Rss.vue +163 -0
  391. package/src/interact/Share.vue +166 -0
  392. package/src/interact/WatchLater.vue +108 -0
  393. package/src/main.js +72 -0
  394. package/src/single/Author.vue +72 -0
  395. package/src/single/Collection.vue +176 -0
  396. package/src/single/Comment.vue +454 -0
  397. package/src/single/Creators.vue +214 -0
  398. package/src/single/PostDirectory.vue +147 -0
  399. package/src/single/PostHeader.vue +397 -0
  400. package/src/single/PostTopic.vue +127 -0
  401. package/src/single/SimpleThx.vue +217 -0
  402. package/src/single/Thx.vue +260 -0
  403. package/src/single/cms-single.vue +235 -0
  404. package/tailwind.config.js +13 -0
  405. package/utils/bus.js +5 -0
  406. package/utils/emotion.js +21 -0
  407. package/utils/index.js +36 -0
  408. package/vue.config.js +158 -0
@@ -0,0 +1,705 @@
1
+ <!--
2
+ * @Author: zhusha
3
+ * @Date: 2025-05-13 10:00:27
4
+ * @LastEditors: zhusha
5
+ * @LastEditTime: 2025-05-20 17:53:49
6
+ * @Description: 悬浮窗组件
7
+ * 关于搜索跳转的问题:如果项目需要跳转微信原生界面,需要引入微信sdk,并使用微信提供的api进行跳转
8
+ <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script> 版本可根据需要查询微信官方文档
9
+ 然后在需要跳转的地方使用以下代码进行跳转
10
+ 例如: wx.miniProgram.navigateTo({ url: "/pages/search/search-detail/search-detail?" + params });
11
+ params为跳转的参数,需要根据项目实际情况进行修改,且需转为&连接的字符串形式,例如: "keyword=1&type=2",可参考以下函数
12
+ miniprogramParams() {
13
+ const params = [];
14
+ for (const key in this.miniprogram) {
15
+ if (this.miniprogram.hasOwnProperty(key)) {
16
+ // params.push(encodeURIComponent(key) + '=' + encodeURIComponent(this.miniprogram[key]));
17
+ params.push(encodeURIComponent(key) + '=' + this.miniprogram[key]);
18
+ }
19
+ }
20
+ return params.join('&');
21
+ }
22
+ *
23
+ * Copyright (c) 2025 by zhusha, email: no email, All Rights Reserved.
24
+ -->
25
+ <template>
26
+ <div class="p-suspend">
27
+ <!-- 初始按钮及配置 -->
28
+ <div class="m-home-box" v-if="btnConfig.showHome">
29
+ <div class="m-base">
30
+ <!-- // TODO自定义展现基础插槽 -->
31
+ <slot></slot>
32
+ </div>
33
+ <div class="m-more" v-if="btnConfig.showMore" @click="setMore">
34
+ <!-- <img class="u-icon" src="../assets/img/suspend/more.svg" svg-inline /> -->
35
+ 更多
36
+ </div>
37
+ </div>
38
+ <!-- 样式分类(icon&more) -->
39
+ <div class="m-icon-box" v-if="btnConfig.showIcon && !btnConfig.showHome">
40
+ <div class="m-btn-box">
41
+ <!-- 搜索按钮-->
42
+ <div v-if="btnConfig.showSearch" class="u-icon-d" @click="search">
43
+ <img class="u-icon" src="../assets/img/suspend/search.svg" svg-inline />
44
+ </div>
45
+ <!-- 固定按钮-->
46
+ <div
47
+ v-if="btnConfig.showFixed"
48
+ class="u-icon-d"
49
+ @click="clickDrawer({ type: 'pin', text: '固定按钮' }, 1)"
50
+ >
51
+ <img
52
+ class="u-icon active"
53
+ src="../assets/img/suspend/pin_touchbar_24.svg"
54
+ svg-inline
55
+ v-if="!fixIsActive"
56
+ />
57
+ <img class="u-icon active" src="../assets/img/suspend/pin_slash_24.svg" svg-inline v-else />
58
+ </div>
59
+ <!-- 收藏按钮-->
60
+ <div
61
+ v-if="btnConfig.showCollect"
62
+ class="u-icon-d"
63
+ @click="clickDrawer({ type: 'collect', text: '收藏' }, 1)"
64
+ >
65
+ <img class="u-icon active" src="../assets/img/suspend/collect.svg" svg-inline v-if="!isCollect" />
66
+ <img class="u-icon active" src="../assets/img/suspend/collect_slash.svg" svg-inline v-else />
67
+ </div>
68
+ <!-- 稍后在看 -->
69
+ <div v-if="btnConfig.showLaterOn" class="u-icon-d" @click="laterOn">
70
+ <img class="u-icon" src="../assets/img/suspend/later-on.svg" svg-inline />
71
+ </div>
72
+ </div>
73
+ <div class="m-more" v-if="btnConfig.showMore" @click="setMore">
74
+ <!-- <img class="u-icon" src="../assets/img/suspend/more.svg" svg-inline /> -->
75
+ 更多
76
+ </div>
77
+ </div>
78
+ <!-- 横向固定内容区域 -->
79
+ <div class="m-pin-box" v-if="btnConfig.showPin && !btnConfig.showHome && !btnConfig.showIcon">
80
+ <div class="u-item" v-for="(item, index) in fixList" :key="'fix' + index">
81
+ <div class="u-text-r" v-if="item.type == 'text'">
82
+ {{ item.title.match(/[\u3400-\u9FFF\uF900-\uFAFF]/)?.[0] || "固" }}
83
+ </div>
84
+ <img :src="item.imgUrl" class="u-icon" v-else />
85
+ </div>
86
+ <!-- 不足三个时显示空位,只在编辑界面显示 -->
87
+ <div class="u-item" v-for="(item, index) in 3 - fixList.length" :key="'fix_no' + index">
88
+ <img src="../assets/img/suspend/circle.svg" svg-inline class="u-icon" />
89
+ </div>
90
+ </div>
91
+ <!-- 抽屉弹出层,支持默认样式和自定义插槽样式 -->
92
+ <el-drawer
93
+ :title="drawerConfig.drawerTitle"
94
+ v-model="drawer"
95
+ :direction="drawerConfig.direction"
96
+ :with-header="false"
97
+ custom-class="u-drawer"
98
+ modal-class="p-drawer-suspend"
99
+ :modal-append-to-body="false"
100
+ append-to-body
101
+ @close="areaKey = 'home'"
102
+ >
103
+ <div class="p-drawer-suspend_box p-bt-transition" v-show="areaKey === 'home'">
104
+ <div class="u-drawer-box">
105
+ <div
106
+ class="u-item top"
107
+ v-for="item in drawerFiltration(drawerType.one)"
108
+ :key="item.type"
109
+ @click="clickDrawer(item)"
110
+ >
111
+ <div class="u-icon" v-if="item.icon || item.icon_slash">
112
+ <img
113
+ :src="item.type == 'pin' ? (fixIsActive ? item.icon_slash : item.icon) : item.icon"
114
+ svg-inline
115
+ />
116
+ </div>
117
+ <div class="u-self" v-if="item.isSlot">
118
+ <!-- 三个圆堆叠式展示 -->
119
+ <div class="u-circle-top">
120
+ <div v-if="fixList?.[0]">
121
+ <div class="u-text-r" v-if="fixList?.[0]?.type == 'text'">
122
+ {{ fixList?.[0]?.title.match(/[\u3400-\u9FFF\uF900-\uFAFF]/)?.[0] || "固" }}
123
+ </div>
124
+ <img :src="fixList?.[0]?.imgUrl" class="u-icon" v-else />
125
+ </div>
126
+ <img src="../assets/img/suspend/circle.svg" svg-inline v-else />
127
+ </div>
128
+ <div class="u-circle-bottom">
129
+ <div class="u-circle" v-for="(item, index) in 2" :key="item">
130
+ <div v-if="fixList?.[index + 1]">
131
+ <div class="u-text-r" v-if="fixList?.[index + 1]?.type == 'text'">
132
+ {{
133
+ fixList?.[index + 1].title.match(/[\u3400-\u9FFF\uF900-\uFAFF]/)?.[0] ||
134
+ "固"
135
+ }}
136
+ </div>
137
+ <img :src="fixList?.[index + 1].imgUrl" class="u-icon" v-else />
138
+ </div>
139
+ <img src="../assets/img/suspend/circle.svg" svg-inline v-else />
140
+ </div>
141
+ </div>
142
+ </div>
143
+ <div class="u-text" :class="item.type">
144
+ {{ item.type == "pin" ? (fixIsActive ? item.text_slash : item.text) : item.text }}
145
+ </div>
146
+ </div>
147
+ <slot name="drawerBox1"></slot>
148
+ </div>
149
+ <div class="u-drawer-box">
150
+ <div
151
+ class="u-item"
152
+ v-for="item in drawerFiltration(drawerType.two)"
153
+ :key="item.type"
154
+ @click="clickDrawer(item)"
155
+ >
156
+ <div class="u-icon" v-if="item.icon">
157
+ <img :src="item.icon" svg-inline />
158
+ </div>
159
+ <div class="u-text" :class="item.type">
160
+ {{ item.text }}
161
+ </div>
162
+ </div>
163
+ <slot name="drawerBox2"></slot>
164
+ </div>
165
+ <div class="u-drawer-box">
166
+ <div
167
+ class="u-item"
168
+ :class="item.type"
169
+ v-for="item in drawerFiltration(drawerType.three)"
170
+ :key="item.type"
171
+ @click="clickDrawer(item)"
172
+ >
173
+ <div class="u-author" v-if="item.isSlot">
174
+ <div class="u-avatar">
175
+ <img :src="drawerConfig.author.avatar" />
176
+ </div>
177
+ <div class="u-author-name">
178
+ {{ drawerConfig.author.name }}
179
+ </div>
180
+ </div>
181
+ <div class="u-text" v-if="!item.isSlot">
182
+ {{ item.text }}
183
+ </div>
184
+ </div>
185
+ <slot name="drawerBox3"></slot>
186
+ </div>
187
+ </div>
188
+
189
+ <transition name="slide-up">
190
+ <!-- 收藏区域 、订阅区域 -->
191
+ <div class="p-drawer-collect p-bt-transition" v-show="areaKey === 'collect' || areaKey === 'rss'">
192
+ <div class="u-collect-icon">
193
+ <img
194
+ src="../assets/img/suspend/collect_touchbar_100.svg"
195
+ svg-inline
196
+ v-if="areaKey === 'collect' && !isCollect"
197
+ />
198
+ <img
199
+ src="../assets/img/suspend/collect_slash_touchbar_100.svg"
200
+ svg-inline
201
+ v-if="areaKey === 'collect' && isCollect"
202
+ />
203
+ <img
204
+ src="../assets/img/suspend/rss_touchbar_100.svg"
205
+ svg-inline
206
+ v-if="areaKey === 'rss' && !isSubscribe"
207
+ />
208
+ <img
209
+ src="../assets/img/suspend/report_100.svg"
210
+ svg-inline
211
+ v-if="areaKey === 'rss' && isSubscribe"
212
+ />
213
+ <div
214
+ class="u-text"
215
+ v-if="(areaKey === 'collect' && !isCollect) || (areaKey === 'rss' && !isSubscribe)"
216
+ >
217
+ {{ areaKey === "collect" ? "收藏" : "订阅" }}作品
218
+ </div>
219
+ </div>
220
+ <div class="u-collect-tips" v-if="areaKey === 'collect'">
221
+ {{ isCollect ? "你已经收藏该作品" : "喜欢程度不够?可以试试添加到稍后再看" }}
222
+ </div>
223
+ <div class="u-collect-tips" v-if="areaKey === 'rss'">
224
+ {{ isSubscribe ? "你已经订阅该作品" : "喜欢程度不够?可以试试添加到稍后再看" }}
225
+ </div>
226
+ <div class="u-btn-box">
227
+ <div class="u-btn collect" @click="collectOrSubscribe">
228
+ {{
229
+ areaKey === "collect"
230
+ ? isCollect
231
+ ? "取消收藏"
232
+ : "收藏"
233
+ : isSubscribe
234
+ ? "取消订阅"
235
+ : "订阅"
236
+ }}作品
237
+ </div>
238
+ <div class="u-btn" @click="laterOn">添加到稍后再看</div>
239
+ </div>
240
+ </div>
241
+ </transition>
242
+ <!-- 固定配置相关页面 -->
243
+ <transition name="slide-up">
244
+ <div class="p-drawer-fix p-bt-transition" v-show="areaKey === 'pin' || areaKey === 'fix'">
245
+ <!-- 固定,取消固定,超量 -->
246
+ <div class="u-collect-icon" v-if="!fixIsEdit">
247
+ <img
248
+ src="../assets/img/suspend/pin_touchbar_100.svg"
249
+ svg-inline
250
+ v-if="!fixIsActive && !fixIsFull"
251
+ />
252
+ <img
253
+ src="../assets/img/suspend/pin_slash_touchbar.svg"
254
+ svg-inline
255
+ v-if="fixIsActive && !fixIsFull"
256
+ />
257
+ <img src="../assets/img/suspend/report_100.svg" svg-inline v-if="fixIsFull" />
258
+ <div class="u-text">{{ fixIsActive ? "取消固定" : "固定内容" }}</div>
259
+ </div>
260
+ <div class="u-collect-tips" v-if="!fixIsActive && !fixIsEdit">
261
+ 你可以随时在其他页面查看固定的内容
262
+ </div>
263
+ <div class="u-edit-title" v-if="fixIsEdit">固定内容</div>
264
+ <div class="u-pin-box">
265
+ <div class="u-item" v-if="!fixIsEdit">
266
+ <div class="u-text-r" v-if="fixPageConfig.type == 'text'">
267
+ {{ fixPageConfig.title.match(/[\u3400-\u9FFF\uF900-\uFAFF]/)?.[0] || "固" }}
268
+ </div>
269
+ <img :src="fixPageConfig.imgUrl" class="u-icon" v-else />
270
+ <div class="u-text">{{ fixPageConfig.title }}</div>
271
+ </div>
272
+ <!-- 只在编辑界面显示 -->
273
+ <div
274
+ class="u-item"
275
+ v-for="(item, index) in fixIsEdit ? fixList : []"
276
+ :key="'fix' + index"
277
+ @click="fixDataClick(item)"
278
+ >
279
+ <div class="u-text-r" v-if="item.type == 'text'">
280
+ {{ item.title.match(/[\u3400-\u9FFF\uF900-\uFAFF]/)?.[0] || "固" }}
281
+ </div>
282
+ <img :src="item.imgUrl" class="u-icon" v-else />
283
+ <div class="u-text">{{ item.title }}</div>
284
+ <div class="u-slash" v-if="fixIsEdit" @click="cancelFix(item)">
285
+ <img src="../assets/img/suspend/pin_slash_touchbar_24.svg" svg-inline />
286
+ </div>
287
+ </div>
288
+ <!-- 不足三个时显示空位,只在编辑界面显示 -->
289
+ <div
290
+ class="u-item"
291
+ v-for="(item, index) in fixIsEdit ? 3 - fixList.length : 0"
292
+ :key="'fix_no' + index"
293
+ >
294
+ <img src="../assets/img/suspend/circle.svg" svg-inline class="u-icon" />
295
+ </div>
296
+ </div>
297
+ <div class="u-btn-box" v-if="!fixIsEdit">
298
+ <div class="u-btn collect" @click="fixClick">确定</div>
299
+ <!-- <div class="u-btn">编辑固定内容</div> -->
300
+ </div>
301
+ <div class="u-collect-tips" v-if="fixIsActive && !fixIsEdit">你可以在原页面再次将其固定</div>
302
+ <div class="u-collect-tips edit" v-if="fixIsEdit">
303
+ 在支持固定的页面可以按
304
+ <img src="../assets/img/suspend/pin_touchbar_24.svg" svg-inline class="u-icon" />
305
+ 将页面固定
306
+ </div>
307
+ </div>
308
+ </transition>
309
+ <!-- 固定页面查看数据、或打开其他远程界面-->
310
+ <transition name="slide-up">
311
+ <div class="p-drawer-fixData p-bt-transition" v-show="areaKey === 'fixData'">
312
+ <!-- 展开界面图标-->
313
+ <div class="u-icon" @click="openUrl">
314
+ <img src="../assets/img/suspend/pin_touchbar_24.svg" svg-inline />
315
+ </div>
316
+ <iframe
317
+ :src="iframeInfo.openurl"
318
+ frameborder="0"
319
+ width="100%"
320
+ height="100%"
321
+ v-if="iframeInfo?.url"
322
+ class="u-iframe"
323
+ />
324
+ <span v-else>查找页面失败</span>
325
+ </div>
326
+ </transition>
327
+ </el-drawer>
328
+ </div>
329
+ </template>
330
+
331
+ <script lang="js">
332
+ import { ElMessage } from "element-plus";
333
+ import { useMediaQuery } from "@vueuse/core";
334
+ import {
335
+ subscribeAuthor,
336
+ unsubscribeAuthor,
337
+ subscribePost,
338
+ unsubscribePost,
339
+ subscribeArticle,
340
+ unsubscribeArticle,
341
+ subscribeWiki,
342
+ unsubscribeWiki,
343
+ getSubscribeStatus,
344
+ getSubscribePostStatus,
345
+ getSubscribeArticleStatus,
346
+ getSubscribeWikiStatus,
347
+ later,
348
+ setCollect,
349
+ getCollectList,
350
+ cancelCollect,
351
+ } from "../service/suspend";
352
+
353
+ // Assets imports
354
+ import searchTouchbar from "../assets/img/suspend/search_touchbar.svg";
355
+ import pinTouchbar from "../assets/img/suspend/pin_touchbar.svg";
356
+ import pinSlashTouchbar40 from "../assets/img/suspend/pin_slash_touchbar_40.svg";
357
+ import collectTouchbar from "../assets/img/suspend/collect_touchbar.svg";
358
+ import rssTouchbar from "../assets/img/suspend/rss_touchbar.svg";
359
+ import lafterTouchbar from "../assets/img/suspend/lafter_touchbar.svg";
360
+
361
+ export default {
362
+ name: "SuspendCommon",
363
+ props: {
364
+ btnOptions: {
365
+ type: Object,
366
+ default: () => ({}),
367
+ },
368
+ //通用弹出框配置
369
+ drawerOptions: {
370
+ type: Object,
371
+ default: () => ({}),
372
+ },
373
+ //固定页缓存相关配置
374
+ fixPageOptions: {
375
+ type: Object,
376
+ default: () => ({}),
377
+ },
378
+ },
379
+ emits: [
380
+ "search",
381
+ "clickBtn",
382
+ "fixPage",
383
+ "fixCancelIndividually",
384
+ "fixDataSwitch",
385
+ "collect",
386
+ "subscribe",
387
+ "laterOn",
388
+ ],
389
+ setup() {
390
+ // useMediaQuery depends on Composition API setup, but can be used in setup() hook of Options API
391
+ const isDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
392
+ return { isDarkMode };
393
+ },
394
+ data() {
395
+ return {
396
+ isDarkModeStatus: false,
397
+ drawer: false,
398
+ areaKey: "home",
399
+ //弹窗type组合
400
+ drawerType: {
401
+ one: [
402
+ { type: "search", text: "搜索内容", icon: searchTouchbar },
403
+ {
404
+ type: "pin",
405
+ text: "固定本页",
406
+ icon: pinTouchbar,
407
+ text_slash: "取消固定",
408
+ icon_slash: pinSlashTouchbar40,
409
+ },
410
+ { type: "fix", text: "查看固定", icon: null, isSlot: true },
411
+ ],
412
+ two: [
413
+ { type: "collect", text: "收藏作品", icon: collectTouchbar },
414
+ { type: "rss", text: "订阅作品", icon: rssTouchbar },
415
+ { type: "laterOn", text: "稍后再看", icon: lafterTouchbar },
416
+ ],
417
+ three: [
418
+ { type: "user", text: "作者", isSlot: true },
419
+ { type: "report", text: "举报" },
420
+ ],
421
+ },
422
+ fixList: [],
423
+ fixIsEdit: false, //固定页是否编辑状态
424
+ isCollect: false,
425
+ collectInfo: {},
426
+ isSubscribe: false,
427
+ subscribeInfo: {},
428
+ iframeInfo: {},
429
+ };
430
+ },
431
+ computed: {
432
+ btnConfig() {
433
+ const defaultConfig = {
434
+ showHome: false, //是否显示home区域,和Icon区域二选一,home区域优先级高于icon区域
435
+ showIcon: true, //是否显示icon区域,此处为false后,则下列配置无效
436
+ showPin: true, //是否显示横向固定区域,需要home和icon都是false才有效
437
+ showSearch: true, //是否显示搜索图标
438
+ showFixed: true, //是否显示固定图标
439
+ showCollect: true, //是否显示收藏图标
440
+ showLaterOn: true, //是否显示稍后再看图标
441
+ showMore: true, //是否显示更多
442
+ };
443
+ return Object.assign({}, defaultConfig, this.btnOptions);
444
+ },
445
+ drawerConfig() {
446
+ const defaultConfig = {
447
+ hideType: ["report"], //需要隐藏的type,如['search','pin']
448
+ direction: "btt", //弹出框方向,btt、ttb、rtl、ltr
449
+ drawerTitle: "", //弹出框标题
450
+ author: {
451
+ name: "", //作者名称
452
+ avatar: "", //作者头像
453
+ author_id: "", //作者id
454
+ },
455
+ subscribeType: "", //订阅类型,用于区分调用百科、文章、作者、帖子等订阅接口,
456
+ postType: "", //订阅、收藏接口的type,如'face','bps','article'等
457
+ id: "", //页面数据ID,用于收藏订阅操作
458
+ title: document.title || "", //默认固定标题,默认取页面标题
459
+ url: window.location.href, //默认取浏览器地址
460
+ laterOn: {
461
+ author_id: 0,
462
+ content_meta_id: 0,
463
+ },
464
+ };
465
+ return Object.assign({}, defaultConfig, this.drawerOptions);
466
+ },
467
+ fixPageConfig() {
468
+ const defaultConfig = {
469
+ key: "jx3box-common-fixed", //默认本地缓存Key
470
+ type: "text", //默认固定类型,text、img
471
+ imgUrl: "", //type是img时需传入图片url用作显示
472
+ title: document.title || "", //默认固定标题,默认取页面标题
473
+ url: window.location.href, //默认取浏览器地址
474
+ };
475
+ return Object.assign({}, defaultConfig, this.fixPageOptions);
476
+ },
477
+ drawerIsShow() {
478
+ return Object.keys(this.drawerConfig).length > 0;
479
+ },
480
+ drawerIsAuthor() {
481
+ return Object.keys(this.drawerConfig.author || {}).length > 0;
482
+ },
483
+ fixIsFull() {
484
+ return this.fixList.length >= 3;
485
+ },
486
+ fixIsActive() {
487
+ return this.fixList.some((item) => item.url === this.fixPageConfig.url);
488
+ },
489
+ },
490
+ mounted() {
491
+ this.fixList = JSON.parse(localStorage.getItem(this.fixPageConfig.key)) || [];
492
+ this.getCollectInfo();
493
+ this.getSubscribeInfo();
494
+ },
495
+ methods: {
496
+ search() {
497
+ this.$emit("search");
498
+ },
499
+ setMore() {
500
+ this.drawer = true;
501
+ this.areaKey = "home";
502
+ },
503
+ drawerFiltration(arr) {
504
+ if (this.drawerConfig.hideType.length > 0) {
505
+ return arr.filter((item) => !this.drawerConfig.hideType.includes(item.type));
506
+ }
507
+ return arr;
508
+ },
509
+ clickDrawer(item, type) {
510
+ if (type == 1) this.drawer = true;
511
+ let switchType = ["collect", "rss", "pin", "fix"];
512
+ if (switchType.includes(item.type)) {
513
+ this.areaKey = item.type;
514
+ }
515
+ if (item.type === "search") {
516
+ this.search();
517
+ }
518
+ if (item.type === "fix") {
519
+ this.fixIsEdit = true;
520
+ } else {
521
+ this.fixIsEdit = false;
522
+ }
523
+ if (item.type === "laterOn") this.laterOn();
524
+ if (item.type === "user") {
525
+ let url = "/author/" + this.drawerConfig.author.author_id;
526
+ this.iframeInfo = { url: url, openurl: url };
527
+ this.areaKey = "fixData";
528
+ }
529
+ this.$emit("clickBtn", { type: item.type, text: item.text });
530
+ },
531
+ fixClick() {
532
+ if (this.fixIsFull) return;
533
+ if (this.fixIsActive) {
534
+ this.fixList = this.fixList.filter((item) => item.url !== this.fixPageConfig.url);
535
+ localStorage.setItem(this.fixPageConfig.key, JSON.stringify(this.fixList));
536
+ } else {
537
+ let json = {
538
+ type: this.fixPageConfig.type,
539
+ title: this.fixPageConfig.title,
540
+ url: this.fixPageConfig.url,
541
+ imgUrl: this.fixPageConfig.imgUrl,
542
+ };
543
+ this.fixList.push(json);
544
+ localStorage.setItem(this.fixPageConfig.key, JSON.stringify(this.fixList));
545
+ }
546
+ this.areaKey = "home";
547
+ this.$emit("fixPage");
548
+ },
549
+ cancelFix(value) {
550
+ this.fixList = this.fixList.filter((item) => item.url !== value.url);
551
+ localStorage.setItem(this.fixPageConfig.key, JSON.stringify(this.fixList));
552
+ this.areaKey = "home";
553
+ this.$emit("fixCancelIndividually");
554
+ },
555
+ fixDataClick(value) {
556
+ if (value.url.indexOf("?") != -1) {
557
+ value.openurl = value.url + "&disabled=true";
558
+ } else {
559
+ value.openurl = value.url + "?disabled=true";
560
+ }
561
+ this.iframeInfo = value;
562
+ this.areaKey = "fixData";
563
+ this.$emit("fixDataSwitch");
564
+ },
565
+ openUrl() {
566
+ location.href = this.iframeInfo.url;
567
+ },
568
+ collectOrSubscribe() {
569
+ this.areaKey == "collect" ? this.collect() : this.subscribe();
570
+ },
571
+ collect() {
572
+ let conf = this.drawerConfig;
573
+ if (this.isCollect) {
574
+ cancelCollect(this.collectInfo.id).then(() => {
575
+ this.isCollect = false;
576
+ this.collectInfo = {};
577
+ });
578
+ } else {
579
+ setCollect(conf.id, conf.postType, conf.title).then((res) => {
580
+ this.isCollect = true;
581
+ this.collectInfo = res.data?.data;
582
+ });
583
+ }
584
+ this.$emit("collect", { isCollect: this.isCollect });
585
+ },
586
+ getCollectInfo() {
587
+ if (!this.drawerConfig.id && !this.drawerConfig.postType) return;
588
+ getCollectList(this.drawerConfig.id, this.drawerConfig.postType).then((res) => {
589
+ this.collectInfo = res.data.data;
590
+ this.isCollect = this.collectInfo?.id > 0;
591
+ });
592
+ },
593
+ subscribe() {
594
+ let conf = this.drawerConfig;
595
+ if (conf.subscribeType === "author") {
596
+ if (this.isSubscribe) {
597
+ unsubscribeAuthor(conf.author.author_id).then(() => {
598
+ this.isSubscribe = false;
599
+ this.subscribeInfo = {};
600
+ this.$emit("subscribe", { isSubscribe: false });
601
+ });
602
+ } else {
603
+ subscribeAuthor(conf.author.author_id, { title: conf.title }).then((res) => {
604
+ this.isSubscribe = true;
605
+ this.subscribeInfo = res.data?.data;
606
+ this.$emit("subscribe", { isSubscribe: true });
607
+ });
608
+ }
609
+ }
610
+ if (conf.subscribeType === "community") {
611
+ if (this.isSubscribe) {
612
+ unsubscribePost(conf.id).then(() => {
613
+ this.isSubscribe = false;
614
+ this.subscribeInfo = {};
615
+ this.$emit("subscribe", { isSubscribe: false });
616
+ });
617
+ } else {
618
+ subscribePost(conf.id, { title: conf.title }).then((res) => {
619
+ this.isSubscribe = true;
620
+ this.subscribeInfo = res.data?.data;
621
+ this.$emit("subscribe", { isSubscribe: true });
622
+ });
623
+ }
624
+ }
625
+ if (conf.subscribeType === "posts") {
626
+ if (this.isSubscribe) {
627
+ unsubscribeArticle(conf.postType, conf.id).then(() => {
628
+ this.isSubscribe = false;
629
+ this.subscribeInfo = {};
630
+ this.$emit("subscribe", { isSubscribe: false });
631
+ });
632
+ } else {
633
+ subscribeArticle(conf.postType, conf.id, { title: conf.title }).then((res) => {
634
+ this.isSubscribe = true;
635
+ this.subscribeInfo = res.data?.data;
636
+ this.$emit("subscribe", { isSubscribe: true });
637
+ });
638
+ }
639
+ }
640
+ if (conf.subscribeType === "wiki") {
641
+ if (this.isSubscribe) {
642
+ unsubscribeWiki(conf.postType, conf.id).then(() => {
643
+ this.isSubscribe = false;
644
+ this.subscribeInfo = {};
645
+ this.$emit("subscribe", { isSubscribe: false });
646
+ });
647
+ } else {
648
+ subscribeWiki(conf.postType, conf.id, { title: conf.title }).then((res) => {
649
+ this.isSubscribe = true;
650
+ this.subscribeInfo = res.data?.data;
651
+ this.$emit("subscribe", { isSubscribe: true });
652
+ });
653
+ }
654
+ }
655
+ },
656
+ getSubscribeInfo() {
657
+ let conf = this.drawerConfig;
658
+ if (conf.subscribeType === "author" && conf.author.author_id) {
659
+ getSubscribeStatus(conf.author.author_id).then((res) => {
660
+ this.isSubscribe = res.data.data?.subscribed;
661
+ this.subscribeInfo = res.data.data;
662
+ });
663
+ }
664
+ if (conf.subscribeType === "community" && conf.id) {
665
+ getSubscribePostStatus(conf.id).then((res) => {
666
+ this.isSubscribe = res.data.data?.subscribed;
667
+ this.subscribeInfo = res.data.data;
668
+ });
669
+ }
670
+ if (conf.subscribeType === "posts" && conf.id && conf.postType) {
671
+ getSubscribeArticleStatus(conf.postType, conf.id).then((res) => {
672
+ this.isSubscribe = res.data.data?.subscribed;
673
+ this.subscribeInfo = res.data.data;
674
+ });
675
+ }
676
+ if (conf.subscribeType === "wiki" && conf.id && conf.postType) {
677
+ getSubscribeWikiStatus(conf.postType, conf.id).then((res) => {
678
+ this.isSubscribe = res.data.data?.subscribed;
679
+ this.subscribeInfo = res.data.data;
680
+ });
681
+ }
682
+ },
683
+ laterOn() {
684
+ let conf = this.drawerConfig;
685
+ let params = {
686
+ author_id: parseInt(conf.laterOn.author_id),
687
+ banner: "",
688
+ category: conf.postType,
689
+ content_meta_id: parseInt(conf.laterOn.content_meta_id),
690
+ link: conf.url,
691
+ title: conf.title,
692
+ };
693
+ later(params).then((res) => {
694
+ ElMessage.success("已添加稍后再看");
695
+ this.areaKey = "home";
696
+ this.$emit("laterOn");
697
+ });
698
+ },
699
+ },
700
+ };
701
+ </script>
702
+
703
+ <style lang="less">
704
+ @import "../assets/css/common/suspend-common.less";
705
+ </style>