@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.
- package/.storybook/preview.js +22 -13
- package/.storybook/storybookMocks.js +214 -0
- package/README.md +39 -43
- package/assets/css/bread/admin.less +20 -2
- package/assets/css/bread/breadcrumb.less +5 -2
- package/assets/css/comment/quick-reply.less +1 -1
- package/assets/css/common/left-sidebar.less +1 -1
- package/assets/css/interact/like2.less +5 -2
- package/assets/css/interact/qrcode.less +69 -0
- package/assets/css/single/author.less +15 -10
- package/assets/css/single/cms-single.less +1 -0
- package/assets/css/single/thx.less +34 -11
- package/assets/css/wiki/wiki-comments.less +176 -0
- package/assets/css/wiki/wiki-panel.less +177 -0
- package/assets/css/wiki/wiki-revisions.less +62 -0
- package/assets/data/nav.json +344 -10
- package/assets/img/comment/comment.svg +1 -1
- package/assets/img/comment/heart_1.svg +1 -1
- package/assets/img/comment/hide.svg +1 -1
- package/assets/img/leftsidebar/medal.svg +1 -1
- package/assets/img/leftsidebar/post.svg +27 -46
- package/i18n/messages/en-US.js +357 -22
- package/i18n/messages/vi.js +350 -22
- package/i18n/messages/zh-CN.js +469 -20
- package/i18n/messages/zh-TW.js +350 -22
- package/index.js +19 -7
- package/package.json +8 -5
- package/service/cms.js +22 -0
- package/service/commit-history.js +18 -0
- package/service/community.js +60 -0
- package/service/fav.js +5 -6
- package/src/App.vue +210 -80
- package/src/Breadcrumb.vue +24 -11
- package/src/CommonFooter.vue +2 -2
- package/src/Footer.vue +13 -5
- package/src/LeftSideToggle.vue +10 -3
- package/src/LeftSidebar.vue +19 -5
- package/src/Main.vue +9 -2
- package/src/RightSidebar.vue +12 -3
- package/src/SuspendCommon.vue +52 -38
- package/src/author/AuthorFans.vue +7 -5
- package/src/author/AuthorFollow.vue +14 -7
- package/src/author/AuthorGift.vue +25 -17
- package/src/author/AuthorInfo.vue +46 -19
- package/src/author/AuthorLink.vue +3 -1
- package/src/author/AuthorMedals.vue +5 -2
- package/src/author/AuthorPosts.vue +31 -13
- package/src/author/AuthorRss.vue +7 -3
- package/src/author/AuthorTeams.vue +3 -1
- package/src/author/UserPop.vue +29 -17
- package/src/bread/Admin.vue +55 -32
- package/src/bread/AdminDirectMessage.vue +15 -8
- package/src/bread/AdminDrop.vue +124 -45
- package/src/bread/CommunityAdmin.vue +527 -0
- package/src/bread/DesignTask.vue +30 -26
- package/src/bread/ListAdmin.vue +199 -0
- package/src/bread/MigrateCommunity.vue +192 -0
- package/src/bread/MoveToCommunityDialog.vue +234 -0
- package/src/comment/Avatar.vue +18 -24
- package/src/comment/CommentContent.vue +57 -37
- package/src/comment/CommentContentSimple.vue +61 -63
- package/src/comment/CommentInputForm.vue +45 -34
- package/src/comment/CommentWithReply.vue +9 -6
- package/src/comment/QuickReply.vue +5 -1
- package/src/comment/ReplyForReply.vue +6 -4
- package/src/comment/ReplyList.vue +28 -18
- package/src/comment/Upload.vue +24 -6
- package/src/filters/clientBy.vue +10 -8
- package/src/filters/markBy.vue +35 -31
- package/src/filters/menuBy.vue +20 -22
- package/src/filters/orderBy.vue +17 -11
- package/src/filters/tagBy.vue +4 -2
- package/src/filters/topicBy.vue +12 -10
- package/src/filters/versionBy.vue +5 -3
- package/src/filters/zlpBy.vue +29 -25
- package/src/footer/copyright.vue +5 -5
- package/src/footer/links.vue +2 -2
- package/src/footer/official.vue +1 -1
- package/src/footer/resource.vue +6 -6
- package/src/header/alternate.vue +35 -18
- package/src/header/asset.vue +9 -19
- package/src/header/box.vue +20 -8
- package/src/header/box2.vue +16 -9
- package/src/header/client.vue +7 -7
- package/src/header/lang.vue +41 -6
- package/src/header/logo.vue +2 -3
- package/src/header/manage.vue +2 -2
- package/src/header/message.vue +3 -3
- package/src/header/nav.vue +26 -23
- package/src/header/publish.vue +2 -2
- package/src/header/search.vue +2 -2
- package/src/header/shop.vue +2 -2
- package/src/header/user.vue +4 -4
- package/src/header/userInfo.vue +22 -24
- package/src/header/vip.vue +2 -2
- package/src/interact/BoxcoinAdmin.vue +30 -16
- package/src/interact/BoxcoinRecords.vue +28 -11
- package/src/interact/BoxcoinUser.vue +33 -17
- package/src/interact/Fav.vue +5 -1
- package/src/interact/Homework.vue +317 -0
- package/src/interact/Like.vue +4 -2
- package/src/interact/QRcode.vue +104 -0
- package/src/interact/Rss.vue +10 -4
- package/src/interact/Share.vue +18 -19
- package/src/interact/WatchLater.vue +5 -1
- package/src/main.js +1 -0
- package/src/single/Author.vue +5 -1
- package/src/single/CmsSingle.vue +29 -15
- package/src/single/Collection.vue +36 -26
- package/src/single/Comment.vue +19 -13
- package/src/single/Creators.vue +5 -3
- package/src/single/PostCollection.vue +158 -0
- package/src/single/PostDirectory.vue +0 -126
- package/src/single/PostGuide.vue +93 -0
- package/src/single/PostHeader.vue +39 -17
- package/src/single/PostTopic.vue +3 -3
- package/src/single/PostVersion.vue +219 -0
- package/src/single/RightAffix.vue +160 -0
- package/src/single/SimpleThx.vue +4 -2
- package/src/single/Thx.vue +14 -2
- package/src/single/VersionDialog.vue +238 -0
- package/src/stories/components/StoryPropsTable.vue +137 -0
- package/src/stories/filters/FilterGallery.stories.js +110 -0
- package/src/stories/filters/clientBy.stories.js +24 -0
- package/src/stories/filters/markBy.stories.js +6 -0
- package/src/stories/filters/menuBy.stories.js +6 -0
- package/src/stories/filters/orderBy.stories.js +6 -0
- package/src/stories/filters/tagBy.stories.js +6 -0
- package/src/stories/filters/topicBy.stories.js +6 -0
- package/src/stories/filters/versionBy.stories.js +6 -0
- package/src/stories/filters/zlpBy.stories.js +6 -0
- package/src/stories/interact/QRcode.stories.js +59 -0
- package/src/stories/layout/BaseShell.stories.js +38 -0
- package/src/stories/layout/Breadcrumb.stories.js +40 -0
- package/src/stories/layout/CommonFooter.stories.js +1 -1
- package/src/stories/layout/CommonHeader.stories.js +1 -1
- package/src/stories/layout/LeftSideToggle.stories.js +78 -0
- package/src/stories/layout/LeftSidebar.stories.js +40 -0
- package/src/stories/layout/Main.stories.js +41 -0
- package/src/stories/layout/RightSidebar.stories.js +36 -0
- package/src/stories/layout/StorybookShell.vue +271 -0
- package/src/stories/layout/SuspendCommon.stories.js +67 -0
- package/src/stories/layout/SuspendCommonStage.vue +143 -0
- package/src/stories/mockData.js +369 -0
- package/src/stories/other/UserPop.stories.js +51 -0
- package/src/stories/single/Author.stories.js +19 -0
- package/src/stories/single/AuthorStoryStage.vue +103 -0
- package/src/stories/single/CmsSingle.stories.js +19 -0
- package/src/stories/single/CmsSingleStoryStage.vue +118 -0
- package/src/stories/single/Collection.stories.js +34 -0
- package/src/stories/single/Comment.stories.js +36 -0
- package/src/stories/single/Creators.stories.js +34 -0
- package/src/stories/single/PostCollection.stories.js +34 -0
- package/src/stories/single/PostDirectory.stories.js +31 -0
- package/src/stories/single/PostGuide.stories.js +47 -0
- package/src/stories/single/PostHeader.stories.js +39 -0
- package/src/stories/single/PostVersion.stories.js +41 -0
- package/src/stories/single/RightAffix.stories.js +84 -0
- package/src/stories/single/SimpleThx.stories.js +39 -0
- package/src/stories/single/SingleGallery.stories.js +207 -0
- package/src/stories/single/Thx.stories.js +38 -0
- package/src/stories/wiki/GamePrice.stories.js +64 -0
- package/src/stories/wiki/WikiComments.stories.js +58 -0
- package/src/stories/wiki/WikiPanel.stories.js +69 -0
- package/src/stories/wiki/WikiRevisions.stories.js +47 -0
- package/src/wiki/GamePrice.vue +107 -0
- package/src/wiki/WikiComment.vue +153 -0
- package/src/wiki/WikiComments.vue +206 -0
- package/src/wiki/WikiPanel.vue +121 -0
- package/src/wiki/WikiRevisions.vue +125 -0
- package/vue.config.js +2 -12
- package/assets/css/common/bottom.less +0 -25
- package/assets/css/editor/article.less +0 -36
- package/assets/css/editor/combo.less +0 -362
- package/assets/css/editor/resource.less +0 -399
- package/assets/css/editor/tinymce.less +0 -100
- package/assets/css/editor/upload.less +0 -136
- package/assets/css/module/author.less +0 -231
- package/assets/css/module/buff.less +0 -88
- package/assets/css/module/directory.less +0 -165
- package/assets/css/module/icon.less +0 -25
- package/assets/css/module/item.less +0 -279
- package/assets/css/module/item_simple.less +0 -58
- package/assets/css/module/jx3_element.less +0 -5
- package/assets/css/module/macro.less +0 -89
- package/assets/css/module/npc.less +0 -265
- package/assets/css/module/resource.less +0 -93
- package/assets/css/module/skill.less +0 -74
- package/assets/css/module/talent.less +0 -495
- package/assets/js/a.js +0 -46
- package/assets/js/code.js +0 -13
- package/assets/js/combo.js +0 -40
- package/assets/js/directory.js +0 -114
- package/assets/js/filter2.js +0 -186
- package/assets/js/fold.js +0 -11
- package/assets/js/gallery.js +0 -14
- package/assets/js/hljs_languages.js +0 -177
- package/assets/js/iframe.js +0 -38
- package/assets/js/img.js +0 -23
- package/assets/js/item/attribute_percent.js +0 -88
- package/assets/js/item/bind.js +0 -18
- package/assets/js/item/border.js +0 -19
- package/assets/js/item/border_quest.js +0 -12
- package/assets/js/item/color.js +0 -25
- package/assets/js/item/hljs_languages.js +0 -177
- package/assets/js/item/icon_url.js +0 -15
- package/assets/js/item/second_format.js +0 -19
- package/assets/js/jx3_element.js +0 -73
- package/assets/js/katex.js +0 -181
- package/assets/js/macro.js +0 -16
- package/assets/js/nextpage.js +0 -4
- package/assets/js/pswp.js +0 -67
- package/assets/js/pswp_template.js +0 -66
- package/assets/js/pz_iframe.js +0 -30
- package/assets/js/qixue.js +0 -28
- package/assets/js/renderImgPreview.js +0 -18
- package/assets/js/script.js +0 -6
- package/assets/js/stat.js +0 -107
- package/assets/js/talent2.js +0 -21
- package/assets/js/tex-mml-chtml.js +0 -36310
- package/assets/js/voice.js +0 -238
- package/assets/js/xss.js +0 -130
- package/src/editor/Article.vue +0 -230
- package/src/editor/BoxResource.vue +0 -441
- package/src/editor/Resource.vue +0 -623
- package/src/editor/Tinymce.vue +0 -204
- package/src/editor/Upload.vue +0 -277
- package/src/editor/UploadAlum.vue +0 -176
- package/src/editor/UploadBanner.vue +0 -156
- package/src/editor/components/Author.vue +0 -322
- package/src/editor/components/Avatar.vue +0 -95
- package/src/editor/components/Buff.vue +0 -80
- package/src/editor/components/Combo.vue +0 -259
- package/src/editor/components/Equip.vue +0 -299
- package/src/editor/components/GameText.vue +0 -242
- package/src/editor/components/Item.vue +0 -325
- package/src/editor/components/ItemSimple.vue +0 -134
- package/src/editor/components/Medal.vue +0 -43
- package/src/editor/components/Npc.vue +0 -215
- package/src/editor/components/PostAuthor.vue +0 -102
- package/src/editor/components/Skill.vue +0 -71
package/assets/js/pswp.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import $ from "jquery";
|
|
2
|
-
import PhotoSwipe from "photoswipe";
|
|
3
|
-
import PhotoSwipeUI_Default from "photoswipe/dist/photoswipe-ui-default";
|
|
4
|
-
import "photoswipe/dist/photoswipe.css";
|
|
5
|
-
import "photoswipe/dist/default-skin/default-skin.css";
|
|
6
|
-
import tpl from "./pswp_template.js";
|
|
7
|
-
// https://photoswipe.com/documentation/options.html
|
|
8
|
-
|
|
9
|
-
class Gallery {
|
|
10
|
-
constructor(options) {
|
|
11
|
-
this._picbox = "";
|
|
12
|
-
this.options = options || {
|
|
13
|
-
bgOpacity: 0.8,
|
|
14
|
-
shareEl: false,
|
|
15
|
-
zoomEl: false,
|
|
16
|
-
closeOnScroll: false,
|
|
17
|
-
};
|
|
18
|
-
this.bucket = [];
|
|
19
|
-
this.items = [];
|
|
20
|
-
this.pswp = "";
|
|
21
|
-
}
|
|
22
|
-
init($root, $selector = "img") {
|
|
23
|
-
// 创建容器
|
|
24
|
-
let isExist = document.querySelectorAll(".pswp").length;
|
|
25
|
-
if (!isExist) $("body").append(tpl);
|
|
26
|
-
this._picbox = document.querySelectorAll(".pswp")[0];
|
|
27
|
-
|
|
28
|
-
//fix需要清空,可能替换内容重复渲染
|
|
29
|
-
this.bucket = [];
|
|
30
|
-
this.items = [];
|
|
31
|
-
|
|
32
|
-
// 缓存图片序列
|
|
33
|
-
$($root)
|
|
34
|
-
.find($selector + ":visible")
|
|
35
|
-
.each((i, $pic) => {
|
|
36
|
-
this.bucket.push($pic);
|
|
37
|
-
this.items.push({
|
|
38
|
-
$el: $pic,
|
|
39
|
-
src: $pic.src,
|
|
40
|
-
w: $pic.naturalWidth || $pic.width || 400,
|
|
41
|
-
h: $pic.naturalHeight || $pic.height || 400,
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// 绑定事件
|
|
46
|
-
$($root)
|
|
47
|
-
.find($selector)
|
|
48
|
-
.on("click", (e) => {
|
|
49
|
-
this.open(e.target);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
open(target) {
|
|
53
|
-
let i = this.bucket.indexOf(target);
|
|
54
|
-
//可能为0
|
|
55
|
-
if (i > -1) {
|
|
56
|
-
let _options = Object.assign(this.options, {
|
|
57
|
-
index: i,
|
|
58
|
-
});
|
|
59
|
-
// 需要在每次调用时重新初始化,因为关闭按钮会自动销毁实例
|
|
60
|
-
let pswp = new PhotoSwipe(this._picbox, PhotoSwipeUI_Default, this.items, _options);
|
|
61
|
-
|
|
62
|
-
pswp.init();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export default new Gallery();
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
export default `<!-- Root element of PhotoSwipe. Must have class pswp. -->
|
|
2
|
-
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
|
|
3
|
-
|
|
4
|
-
<!-- Background of PhotoSwipe.
|
|
5
|
-
It's a separate element as animating opacity is faster than rgba(). -->
|
|
6
|
-
<div class="pswp__bg"></div>
|
|
7
|
-
|
|
8
|
-
<!-- Slides wrapper with overflow:hidden. -->
|
|
9
|
-
<div class="pswp__scroll-wrap">
|
|
10
|
-
|
|
11
|
-
<!-- Container that holds slides.
|
|
12
|
-
PhotoSwipe keeps only 3 of them in the DOM to save memory.
|
|
13
|
-
Don't modify these 3 pswp__item elements, data is added later on. -->
|
|
14
|
-
<div class="pswp__container">
|
|
15
|
-
<div class="pswp__item"></div>
|
|
16
|
-
<div class="pswp__item"></div>
|
|
17
|
-
<div class="pswp__item"></div>
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
<!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
|
|
21
|
-
<div class="pswp__ui pswp__ui--hidden">
|
|
22
|
-
|
|
23
|
-
<div class="pswp__top-bar">
|
|
24
|
-
|
|
25
|
-
<!-- Controls are self-explanatory. Order can be changed. -->
|
|
26
|
-
|
|
27
|
-
<div class="pswp__counter"></div>
|
|
28
|
-
|
|
29
|
-
<button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
|
|
30
|
-
|
|
31
|
-
<button class="pswp__button pswp__button--share" title="Share"></button>
|
|
32
|
-
|
|
33
|
-
<button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
|
|
34
|
-
|
|
35
|
-
<button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
|
|
36
|
-
|
|
37
|
-
<!-- Preloader demo https://codepen.io/dimsemenov/pen/yyBWoR -->
|
|
38
|
-
<!-- element will get class pswp__preloader--active when preloader is running -->
|
|
39
|
-
<div class="pswp__preloader">
|
|
40
|
-
<div class="pswp__preloader__icn">
|
|
41
|
-
<div class="pswp__preloader__cut">
|
|
42
|
-
<div class="pswp__preloader__donut"></div>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
|
|
48
|
-
<div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
|
|
49
|
-
<div class="pswp__share-tooltip"></div>
|
|
50
|
-
</div>
|
|
51
|
-
|
|
52
|
-
<button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
|
|
53
|
-
</button>
|
|
54
|
-
|
|
55
|
-
<button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
|
|
56
|
-
</button>
|
|
57
|
-
|
|
58
|
-
<div class="pswp__caption">
|
|
59
|
-
<div class="pswp__caption__center"></div>
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
</div>
|
|
65
|
-
|
|
66
|
-
</div>`;
|
package/assets/js/pz_iframe.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import $ from "jquery";
|
|
2
|
-
function buildIframe(str){
|
|
3
|
-
let _str = new URLSearchParams(str);
|
|
4
|
-
let mode = _str.get('mode')
|
|
5
|
-
|
|
6
|
-
if(mode == 'vertical'){
|
|
7
|
-
return `<iframe class="w-pz-iframe" src="${str}" scrolling="no" width="750" height="3468" style="border:none;background:none;max-width:100%;overflow:hidden;"></iframe>`
|
|
8
|
-
}else{
|
|
9
|
-
return `<iframe class="w-pz-iframe" src="${str}" scrolling="no" width="1280" height="720" style="border:none;background:none;max-width:100%;overflow:hidden;"></iframe>`
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function renderPzIframe(selector = ".e-pz-iframe"){
|
|
14
|
-
try {
|
|
15
|
-
$(selector).each(function() {
|
|
16
|
-
// 获取嵌入源地址
|
|
17
|
-
let url = $(this).text();
|
|
18
|
-
|
|
19
|
-
// 构建嵌入源码
|
|
20
|
-
let code = buildIframe(url)
|
|
21
|
-
|
|
22
|
-
// 挂载点
|
|
23
|
-
$(this).after(code);
|
|
24
|
-
});
|
|
25
|
-
} catch (e) {
|
|
26
|
-
console.error(e);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default renderPzIframe
|
package/assets/js/qixue.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import JX3_QIXUE from '@jx3box/jx3box-talent'
|
|
2
|
-
import $ from 'jquery'
|
|
3
|
-
|
|
4
|
-
function qixue(selector=".e-jx3qixue-area"){
|
|
5
|
-
try {
|
|
6
|
-
$(selector).each(function (){
|
|
7
|
-
|
|
8
|
-
// 挂载点
|
|
9
|
-
$(this).after('<div class="e-jx3qixue-temp-container"></div>')
|
|
10
|
-
let container = $(this).next('.e-jx3qixue-temp-container')
|
|
11
|
-
|
|
12
|
-
// 内容解析
|
|
13
|
-
let qixue = ''
|
|
14
|
-
if($(this)[0].tagName == "INPUT"){
|
|
15
|
-
qixue = JSON.parse($(this).val())
|
|
16
|
-
}else{
|
|
17
|
-
qixue = JSON.parse($(this).text())
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
let _qixue = Object.assign({container:container},{...qixue, client: qixue?.client || 'std'})
|
|
21
|
-
new JX3_QIXUE(_qixue)
|
|
22
|
-
})
|
|
23
|
-
} catch (e) {
|
|
24
|
-
console.error(e);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export default qixue
|
|
28
|
-
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import $ from "jquery";
|
|
2
|
-
import "viewerjs/dist/viewer.css";
|
|
3
|
-
import Viewer from "viewerjs";
|
|
4
|
-
|
|
5
|
-
function renderImgPreview(selector = ".c-article img") {
|
|
6
|
-
// 获取src不为空的图片
|
|
7
|
-
let imgs = $(selector).filter(function () {
|
|
8
|
-
return $(this).attr("src") != "";
|
|
9
|
-
});
|
|
10
|
-
imgs.each((i, ele) => {
|
|
11
|
-
new Viewer(ele, {
|
|
12
|
-
toolbar: false,
|
|
13
|
-
navbar: false,
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default renderImgPreview;
|
package/assets/js/script.js
DELETED
package/assets/js/stat.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Reporter
|
|
3
|
-
} from "@jx3box/reporter"
|
|
4
|
-
import JX3BOX from "@jx3box/jx3box-common/data/jx3box.json";
|
|
5
|
-
import { $next } from "@jx3box/jx3box-common/js/api";
|
|
6
|
-
|
|
7
|
-
const { __Domain } = JX3BOX;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 16进制转int
|
|
11
|
-
* @param {string} str
|
|
12
|
-
* @returns
|
|
13
|
-
* @memberof stat
|
|
14
|
-
*/
|
|
15
|
-
function int162hex(str) {
|
|
16
|
-
let hex = str.toString(16);
|
|
17
|
-
return hex.length == 1 ? "0" + hex : hex;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* 二进制转hex
|
|
22
|
-
* @param {string} str
|
|
23
|
-
*/
|
|
24
|
-
function bin2hex(str) {
|
|
25
|
-
let result = "";
|
|
26
|
-
for (let i = 0; i < str.length; i++) {
|
|
27
|
-
result += int162hex(str.charCodeAt(i));
|
|
28
|
-
}
|
|
29
|
-
return result;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* 获取uuid
|
|
34
|
-
*/
|
|
35
|
-
function getUUID(domain = __Domain) {
|
|
36
|
-
const canvas = document.createElement("canvas");
|
|
37
|
-
const ctx = canvas.getContext("2d");
|
|
38
|
-
const txt = domain;
|
|
39
|
-
ctx.textBaseline = "top";
|
|
40
|
-
ctx.font = "14px 'Arial'";
|
|
41
|
-
ctx.textBaseline = "alphabetic";
|
|
42
|
-
ctx.fillStyle = "#f60";
|
|
43
|
-
ctx.fillRect(125, 1, 62, 20);
|
|
44
|
-
ctx.fillStyle = "#069";
|
|
45
|
-
ctx.fillText(txt, 2, 15);
|
|
46
|
-
ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
|
|
47
|
-
ctx.fillText(txt, 4, 17);
|
|
48
|
-
|
|
49
|
-
const b64 = canvas.toDataURL().replace("data:image/png;base64,", "");
|
|
50
|
-
const bin = atob(b64);
|
|
51
|
-
const crc = bin2hex(bin.slice(-16, -12));
|
|
52
|
-
return crc;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// 统计指令
|
|
56
|
-
const stat = {
|
|
57
|
-
/**
|
|
58
|
-
* 上报指令 vue2
|
|
59
|
-
* @param {string} user_id 用户id 使用User.getInfo().uid获取
|
|
60
|
-
* @param {boolean} use_query 是否上报当前页面中url中的参数 默认false
|
|
61
|
-
* @param {string} caller 上报来源
|
|
62
|
-
* @param {object} data 上报数据
|
|
63
|
-
*/
|
|
64
|
-
install(Vue) {
|
|
65
|
-
Vue.directive("stat", {
|
|
66
|
-
mounted: function (el, binding) {
|
|
67
|
-
el.clickHandler = function () {
|
|
68
|
-
const {
|
|
69
|
-
user_id,
|
|
70
|
-
use_query = false,
|
|
71
|
-
caller,
|
|
72
|
-
data
|
|
73
|
-
} = binding.value;
|
|
74
|
-
|
|
75
|
-
const R = new Reporter({
|
|
76
|
-
caller,
|
|
77
|
-
use_query, // 上报当前页面中url中的参数 默认false
|
|
78
|
-
useId: user_id // 当前登录用户id
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
R.p({ uuid: getUUID(), ...data })
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
el.addEventListener("click", el.clickHandler);
|
|
85
|
-
},
|
|
86
|
-
unmounted: function (el) {
|
|
87
|
-
el.removeEventListener("click", el.clickHandler);
|
|
88
|
-
el.clickHandler = null;
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* 添加历史记录
|
|
96
|
-
* @param {*} data
|
|
97
|
-
* @param {*} data.source_type 例如:macro,community
|
|
98
|
-
* @param {*} data.source_id 例如:文章id,帖子id
|
|
99
|
-
* @param {*} data.link 例如:文章链接,帖子链接
|
|
100
|
-
* @param {*} data.title 例如:文章标题,帖子标题
|
|
101
|
-
* @returns
|
|
102
|
-
*/
|
|
103
|
-
export function postHistory(data) {
|
|
104
|
-
return $next({mute: true}).post("/api/next2/userdata/visit-history/item", data);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export default stat;
|
package/assets/js/talent2.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import $ from "jquery";
|
|
2
|
-
import { Base64 } from "js-base64";
|
|
3
|
-
function talent2(selector = ".e-jx3talent2-area") {
|
|
4
|
-
try {
|
|
5
|
-
$(selector).each(function() {
|
|
6
|
-
// 挂载点
|
|
7
|
-
$(this).after('<div class="e-jx3talent2-temp-container" style="width:100%;height:525px;overflow:hidden;"></div>');
|
|
8
|
-
let container = $(this).next(".e-jx3talent2-temp-container");
|
|
9
|
-
|
|
10
|
-
// 内容解析
|
|
11
|
-
let talent = $(this).text();
|
|
12
|
-
let code = Base64.encode(talent);
|
|
13
|
-
let url = "https://oss.jx3box.com/static/jx3box-talent2/index.html" + "?code=" + code;
|
|
14
|
-
|
|
15
|
-
container.html(`<iframe src="${url}" width="100%" height="100%" style="overflow:hidden;border:none;"></iframe>`);
|
|
16
|
-
});
|
|
17
|
-
} catch (e) {
|
|
18
|
-
console.error(e);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export default talent2;
|