const{createApp}=Vue const{createVuetify,useGoTo,useDisplay}=Vuetify var data={alert:{show:false,color:'success',text:'',timeout:0,},theme:{dark:false,},nav:{showDrawer:false,showTOC:true,tocPanel:0,tab:'account',post:{discussionId:8620,currentPage:1,targetPage:1,total:40,anchor:0,goToOptions:{container:null,duration:0,easing:'easeInOutCubic',offset:-100,},worker:null,task:[],active:[],apiLock:[],originLike:new Map([]),},related:{block:1,}},search:{width:80,text:null,loading:false,},tags:[],posts:[{id:115558,num:0,uid:7475,content:'\u003Cp\u003E目前在黑曜石等级,感觉比之前级别保级难度太大了,每天学习打卡不低于 15 分钟,基本上刷出倍率积分才会通过经验上升经验值,目前还是处于滑降地带。。\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 09:56:13',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115559,num:1,uid:9260,content:'肯定要刷倍率的,竞标赛才是难打,有些都是一周 1W 多的,都不知道怎么刷来的。。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 09:58:36',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115560,num:2,uid:16506,content:'高等级以后有很多机器人,个人主页都看不了,学的语言都是乱七八糟。\u003Cbr\u003E自己按照自己的规划来学习就好了,没必要刻意为了这个弄得自己反而不想学习了。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 10:06:03',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115561,num:3,uid:6499,content:'如果只想刷级 不要学习效果 刷口语题就行',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 10:17:17',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115562,num:4,uid:490,content:'最近太卷了,从黑曜石一路跌到珍珠了',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 10:18:46',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115563,num:5,uid:19121,content:'每天三个任务,其中两个每完成一个可以+10min 倍率时长,还有一个是次日获得三倍. \u003Cbr\u003E上午打卡有 early bird chest,晚上六点后打卡有 night owl chest,可以上午打卡叠加昨天的 night owl chest,晚上打卡叠加上午的 eraly bird chest. 还有完成好友任务会奖励 30min 倍率时长. 都可以叠加.\u003Cbr\u003E接下来直奔排行榜的挑战赛,刷到锁定最高档位 40,重复练习配合三倍率就可以一次+120XP 了.\u003Cbr\u003E早先每周六还有 1 小时的倍率奖励时长,现在好像取消了.',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 10:19:41',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115564,num:6,uid:262,content:'油管有不少视频,论证和实践了用多邻国学语言效果一般',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 10:26:04',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[16,],mentionUsers:[],likeUsers:[],},{id:115565,num:7,uid:13740,content:'我是主要刷英语,时间有限就刷数学来挣经验',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 10:28:00',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115566,num:8,uid:6615,content:'还好吧,目前钻石 33 周,也就早晚各 15 分钟,早晚宝箱记得用,然后就是做任务得经验加倍卡,用这两个很容易刷上去,一倍经验学到死也刷不了榜呀',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 10:35:04',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115567,num:9,uid:18976,content:'有很多人都是刻意刷分的,比如刷出来倍率之后做一开始的初始课程,简单时间短效率高,所以现在都没有什么兴趣看这个等级了。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 10:45:57',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115568,num:10,uid:7475,content:'确实离谱😂',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 10:47:28',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115569,num:11,uid:7475,content:'原来是这样。。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 10:47:52',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115570,num:12,uid:19122,content:'买了两年会员,今年准备弃坑了,感觉学日语还是需要系统性的学习,单纯靠多邻国学不会',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 10:48:37',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115571,num:13,uid:7475,content:'666666 ,玩儿的溜啊😄',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 10:49:02',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115572,num:14,uid:7475,content:'我现在主要是学法语,之前粤语、英语学到一定程度,课程已经不再更新了。。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 10:50:10',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115573,num:15,uid:19123,content:'好吧,告诉你个小秘密,坚持玩到最后一关的单词配对,叠加 3 倍奖励,每次 225😄',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 11:12:25',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115574,num:16,uid:18193,content:'#6 学了一年感觉也是如此,有什么好的学英语软件推荐吗',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 11:17:57',updatedAt:'2025-04-19 23:48:10',mentionNum:6,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115575,num:17,uid:14620,content:'在淘宝买那种 一两块一个月的家庭会员。。不要买年付的,因为店家会跑路。。一个月的这种就是纯赚。。年付的大概会是冤大头',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 11:33:50',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115576,num:18,uid:7475,content:'这玩意儿还在淘宝上买?直接找家庭组吧,淘宝不靠谱',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 11:41:28',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115577,num:19,uid:502,content:'作为流利的三语者的学习经验是(托福差两分满分\u0026amp;韩语满级)用那玩意一辈子学不好外语的',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 12:44:15',updatedAt:'2025-04-19 23:48:10',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[490,{uid:490,url:'/u/090b5e0e6a045c776463566f1623390b',avatar:'/a/090b5e0e6a045c776463566f1623390b',username:'Leon777🤖',}],[262,{uid:262,url:'/u/363b7c036a045c77626c546f123d2116',avatar:'/a/363b7c036a045c77626c546f123d2116',username:'MonikaCeng🤖',}],[18193,{uid:18193,url:'/u/3c2446036a045d7f6163556f113d3630',avatar:'/a/3c2446036a045d7f6163556f113d3630',username:'southlink🤖',}],[19122,{uid:19122,url:'/u/6a04425d6a045d7e6168546f3258250d',avatar:'/a/6a04425d6a045d7e6168546f3258250d',username:'grc19900🤖',}],[16506,{uid:16506,url:'/u/19267c046a045d71656a506f10003a3e',avatar:'/a/19267c046a045d71656a506f10003a3e',username:'wdo🤖',}],[7475,{uid:7475,url:'/u/171c0b356a045c70646d536f0e043c7e',avatar:'/a/171c0b356a045c70646d536f0e043c7e',username:'Mryang🤖',}],[18976,{uid:18976,url:'/u/6d2c58266a045d7f696d506f195c0022',avatar:'/a/6d2c58266a045d7f696d506f195c0022',username:'PhantomAlan🤖',}],[14620,{uid:14620,url:'/u/310c070b6a045d736668566f4f262a37',avatar:'/a/310c070b6a045d736668566f4f262a37',username:'lycpang🤖',}],[13740,{uid:13740,url:'/u/363e78016a045d74676e566f02281c2a',avatar:'/a/363e78016a045d74676e566f02281c2a',username:'oyjt🤖',}],[6499,{uid:6499,url:'/u/0a237d096a045c7164635f6f4f1a1f73',avatar:'/a/0a237d096a045c7164635f6f4f1a1f73',username:'worldqiuzhi🤖',}],[6615,{uid:6615,url:'/u/1107455a6a045c71666b536f3103142e',avatar:'/a/1107455a6a045c71666b536f3103142e',username:'zy445566🤖',}],[19123,{uid:19123,url:'/u/2a2e5a186a045d7e6168556f040b2232',avatar:'/a/2a2e5a186a045d7e6168556f040b2232',username:'hd2ex🤖',}],[19121,{uid:19121,url:'/u/6d1b70216a045d7e6168576f210c0a0d',avatar:'/a/6d1b70216a045d7e6168576f210c0a0d',username:'ajunno🤖',}],[9260,{uid:9260,url:'/u/627067596a045c7e626c566f4e272336',avatar:'/a/627067596a045c7e626c566f4e272336',username:'vanityfairn🤖',}],[502,{uid:502,url:'/u/171147216a045c77656a546f022f0528',avatar:'/a/171147216a045c77656a546f022f0528',username:'SiLenceControL🤖',}],]),related:[],} const App={setup(){const goTo=useGoTo() const{mdAndUp}=useDisplay() return{goTo,mdAndUp}},data(){return data;},mounted(){const themeDark=localStorage.getItem("themeDark") if(themeDark!==null){this.theme.dark=JSON.parse(themeDark)} if(this.nav.post.total>(this.nav.post.currentPage-1)*100+20){let moreLen=100 if(this.nav.post.total({id:null,num:(this.nav.post.currentPage-1)*100+v,uid:null,content:null,ipRegion:null,updatedByUid:null,createdAt:null,updatedAt:null,mentionNum:null,mentionedBy:null,mentionUsers:null,likeUsers:null,})) this.posts.push(...morePosts.slice(20))} this.workerStart() const hash=window.location.hash const match=hash.match(/#(\d+)/) if(match){const n=parseInt(match[1],10) if(n>=(this.nav.post.currentPage-1)*100&&n{this.jumpTo(n)})}} this.$nextTick(()=>{this.addHeadingIds() tocbot.init({tocSelector:'.toc',contentSelector:'#post-content-0',headingSelector:'h2, h3, h4',headingsOffset:100,scrollSmoothOffset:-100,scrollSmooth:true,collapseDepth:6,onClick:function(e){setTimeout(()=>{history.replaceState(null,'',window.location.pathname+window.location.search)},0)},}) tocbot.refresh()});},beforeUnmount(){this.workerStop() if(this.quill){this.quill.destroy() this.quill=null}},computed:{dposts(){return this.posts.slice(20);},},created(){},methods:{successAlert(msg){this.alert={show:true,color:'success',text:msg,timeout:1500,}},failureAlert(msg){this.alert={show:true,color:'error',text:msg,timeout:5000,}},flipThemeDark(){this.theme.dark=!this.theme.dark localStorage.setItem("themeDark",JSON.stringify(this.theme.dark))},toSearch(){if(!this.search.text){this.failureAlert('搜索词不能为空') return} let keywords=this.search.text.trim() if(keywords.length<1){this.failureAlert('搜索词不能为空') return} if(keywords.length>100){this.failureAlert('搜索词过长') return} this.doSearch(keywords)},toReg(){window.location.href="/reg"},toLogin(){window.location.href="/login"},toPage(){let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,this.nav.post.targetPage>1?`/${this.nav.post.targetPage}`:'') window.location.href=url},toLoadRelated({done}){if(this.my&&this.my.uid){this.apiLoadRelated({done})}else{done('ok')}},workerStart(){this.nav.post.worker=setInterval(()=>{this.workerLoad()},500);},workerStop(){if(this.nav.post.worker){clearInterval(this.nav.post.worker);this.nav.post.worker=null;}},async jumpTo(num){const page=Math.floor(num/100)+1 const i=num-(page-1)*100 if(page===this.nav.post.currentPage){this.goTo("#post-"+num,this.nav.post.goToOptions) if(!this.posts[i].id){const block=Math.floor(num/20)+1 this.nav.post.apiLock[block]=true await this.apiLoadPosts(block) this.$nextTick(()=>{this.goTo("#post-"+num,this.nav.post.goToOptions)})}}else{let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,page>1?`/${page}`:'') url=url+"#"+num window.location.href=url}},postIntersect(num){return(isIntersecting,entries,observer)=>{if(isIntersecting){this.nav.post.task.push(num) this.nav.post.active.push(num) this.nav.post.active=this.nav.post.active.filter(item=>Math.abs(item-num)<=5) this.nav.post.active.sort((a,b)=>a-b)}else{this.nav.post.active=this.nav.post.active.filter(item=>item!==num)} if(this.nav.post.active[0]){this.nav.post.anchor=this.nav.post.active[0]}else{this.nav.post.anchor=0}}},async apiLoadPosts(block){try{const response=await axios.post('/fapi/v1/post/block/'+block,{discussionId:this.nav.post.discussionId,}) if(response.data.code===0){response.data.data.posts.forEach(post=>{const i=post.num%100 Object.assign(this.posts[i],post)}) response.data.data.users.forEach(user=>{this.usersMap.set(user.uid,user)})}else{this.failureAlert('回帖数据加载失败: '+response.data.msg)}}catch(error){this.failureAlert('回帖数据加载失败: '+error)} this.nav.post.apiLock[block]=false},workerLoad(){while(this.nav.post.task.length){const num=this.nav.post.task.pop() const i=num-(this.nav.post.currentPage-1)*100 if(!this.posts[i].id){const block=Math.floor(num/20)+1 if(!this.nav.post.apiLock[block]){this.nav.post.apiLock[block]=true this.apiLoadPosts(block)}}}},getTimeInfo(t){if(!t){return ""} const now=new Date();const then=new Date(t);const diff=now-then;const minute=60*1000;const hour=minute*60;const day=hour*24;const month=day*30;const year=month*12;if(diffpost.num===num) if(!post){return "#"+num} const uid=post.uid const username=this.usersMap.get(uid)?.username if(!username){return "#"+num} return username},getUsernameByPostId(id){const post=this.posts.find(post=>post.id===id) if(!post){return "#"+this.getPostNumByPostId(id)} const uid=post.uid const username=this.usersMap.get(uid).username if(!username){return "#"+this.getPostNumByPostId(id)} return username},getPostNumByPostId(id){const post=this.posts.find(post=>post.id===id) return post.num},getPostById(id){const post=this.posts.find(post=>post.id===id) return post},getPostByNum(num){const post=this.posts.find(post=>post.num===num) return post},getAvatarByUid(uid){const avatar=this.usersMap.get(uid)?.avatar if(!avatar){return this.getRandomAvatar()} return avatar},getAvatarByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post){return this.getRandomAvatar()} const uid=post.uid return this.getAvatarByUid(uid)},getRandomAvatar(){const num=Math.floor(Math.random()*100) return "https://randomuser.me/api/portraits/men/"+num+".jpg"},getUrlByUid(uid){const url=this.usersMap.get(uid)?.url if(!url){return ""} return url},getTextByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post||!post.content){return '点击跳转到#'+num+'查看'} const parser=new DOMParser() const doc=parser.parseFromString(post.content,'text/html') const text=doc.body.textContent||'' return text.slice(0,100)},addHeadingIds(){const content=document.getElementById('post-content-0') if(!content){this.nav.showTOC=false return} const headings=content.querySelectorAll('h2, h3, h4') headings.forEach((heading,index)=>{if(!heading.id){heading.id=`toc-nav-${index}`}}) if(headings.length==0){this.nav.showTOC=false}},async doSearch(keywords){this.search.loading=true try{const response=await axios.post('/fapi/v1/search',{keywords:keywords,}) if(response.data.code===0){if(response.data.data.hash&&response.data.data.hash.length===32){window.location.href="/s/"+response.data.data.hash}else{this.failureAlert('搜索失败: 搜索服务异常')}}else{this.failureAlert('搜索失败: '+response.data.msg)}}catch(error){this.failureAlert('搜索失败: '+error)} this.search.loading=false},debounce(fn,delay){let timer=null return function(...args){if(timer)clearTimeout(timer) timer=setTimeout(()=>{fn.apply(this,args)},delay);};},},watch:{'nav.post.targetPage':{handler:async function(newV,oldV){this.toPage()},immediate:false},},} const vuetify=createVuetify({defaults:{global:{ripple:true,},},}) const app=createApp(App) app.use(vuetify).mount("#app")