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:8527,currentPage:1,targetPage:1,total:101,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:113522,num:0,uid:9619,content:'兄弟们还是不能太饿啊,否则只有翻车兄弟母胎 26 嘛,眼瞅着马上 27 了,想着找个对象,所以下了个 soul 玩了一段时间先简单说一下可能遇到的问题(目前遇到的)1.直播托,不要去语音房间,那里面相亲的大把都是直播托,你以为相亲冲了你下去就完了就可以开始谈了,错!大错特错,一开始还好,后面你就会发现她是有正常工作,然后业余做直播的,她不会问你要钱,但是在她的朋友圈会发“今天还差多少礼物完成任务”!这把 soul 冲了 400 块,至此第一次失败2.质量堪忧,可以想象一下什么女生会去玩这种社交软件,那多半是现实不咋滴的,建议不要屎里淘金,我就是后面聊了一个,因为第一此直播托的原因,这次的女生我聊了几天就约出来准备线下聊聊,没想到又翻车了,这次线上没咋聊,只知道是个做文员的,约出来她说她想去春熙路,我说那行,我还以为去春熙路逛逛吃点零食啥的最多请个吃饭。见面以后她说看了小红书,春熙路有那种情侣做手工的,想去试试,我当时觉得还行所以说去,到了以后第一个就是卖银戒指的,她想要然后就看着我,把我驾着下不来台,现在银子那么 jb 便宜,两个不知道几克轻到不行的破银戒指,要 1500 ,我去他奶奶的,我买单了,然后接下来再走,她又看见卖娃娃的,那个哇哇那么 jb 辣鸡,一个要 400 块,买了俩一共 800 ,还有更恶心的,还有做手工巧克力的,那个巧克力那么 jb 廉价,最**的巧克力,要 400 块,他妈的她也买,是不是没脑子,按她说的她是个文员,jb 成都一个月最多算她 5k 工资,知不知道已经花了她大半个月工资了?给我整吐了,不过因为是我自己约出来的,还是买单了,至此第二次失败3.第三次,我还是新存希望,我觉得可能是因为第二个女孩子是有毛病的,我又聊了一个,正打算约她出来呢,我问她想去哪里,她说她想去春熙路做手工!!!!!!兄弟们,还是不要太饿了,还是线下去搭讪吧,别网恋了,碰到正常人几率贼低!',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:10:02',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:113523,num:1,uid:148,content:'我也想去春熙路做手工!',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:12:29',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:113524,num:2,uid:8301,content:'性压抑了',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:13:57',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:113525,num:3,uid:879,content:'听我的手工不如自动的',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:15:20',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:113526,num:4,uid:18264,content:'我也想去春熙路做手工!',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:15:26',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:113527,num:5,uid:5861,content:'啊,你这,怎么做到一见面就能花这么多的?春熙路,看来也在成都,已知的,1k2p 的多的是,何必呢?',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:16:06',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:113528,num:6,uid:4076,content:'脸皮厚一点,发现对方把你当 atm ,果断当面拒绝。拒绝一个陌生人,你有什么不好意思的?',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:16:13',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[11,],mentionUsers:[],likeUsers:[],},{id:113529,num:7,uid:12690,content:'兄弟,第一次见面就这么花钱吗',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:16:43',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:113530,num:8,uid:590,content:'鱼塘里有吃的,但都是鱼饵。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:17:03',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:113531,num:9,uid:13780,content:'可以去大学城附近看看,线上不靠谱',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:17:32',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:113532,num:10,uid:12110,content:'虽然你很惨,但是也是真的好笑,再配上这个标题,你还特么拼错了,我笑得满地找头。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:17:39',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[15,],mentionUsers:[],likeUsers:[],},{id:113533,num:11,uid:9619,content:'#6 没经验撒,后面我就直接把 3 号删了',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:17:43',updatedAt:'2025-04-19 23:46:35',mentionNum:6,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:113534,num:12,uid:5755,content:'段子来源于生活',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:17:52',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:113535,num:13,uid:3946,content:'笑死,就这么动不动为女生买单的,不管啥渠道,迟早还要踩坑。。。男的要多学习怎么让女的为自己买单,而不是为女的买单,这才是硬实力。。。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:18:20',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:113536,num:14,uid:18909,content:'这够包一次嫩模了 \u003Cimg src\u003D\"https://i.imgur.com/Ug1iMq4.png\"\u003E,上了没?',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:18:20',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:113537,num:15,uid:9619,content:'#10 哈哈哈,没注意',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:18:37',updatedAt:'2025-04-19 23:46:35',mentionNum:10,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:113538,num:16,uid:126,content:'3k 学个教训,总比一点一点蚕食要好',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:18:39',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:113539,num:17,uid:1080,content:'小红书一搜,发现春熙路真的是骗子成群了。。。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:19:08',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:113540,num:18,uid:5595,content:'是不是和手工有什么梦幻联动啊!',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:19:35',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:113541,num:19,uid:4516,content:'好好好,站内今日热帖预定!',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 14:19:41',updatedAt:'2025-04-19 23:46:35',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[5595,{uid:5595,url:'/u/1e1c702c6a045c726563536f24023e06',avatar:'/a/1e1c702c6a045c726563536f24023e06',username:'aladd🤖',}],[12690,{uid:12690,url:'/u/2b2c7d1f6a045d756663566f4f2b6134',avatar:'/a/2b2c7d1f6a045d756663566f4f2b6134',username:'lei2j🤖',}],[13780,{uid:13780,url:'/u/380e5a3a6a045d746762566f202c0604',avatar:'/a/380e5a3a6a045d746762566f202c0604',username:'metory🤖',}],[18264,{uid:18264,url:'/u/1b0b63056a045d7f626c526f233a6a26',avatar:'/a/1b0b63056a045d7f626c526f233a6a26',username:'lolicondmw🤖',}],[18909,{uid:18909,url:'/u/221163156a045d7f696a5f6f0020390a',avatar:'/a/221163156a045d7f696a5f6f0020390a',username:'aeiou520🤖',}],[8301,{uid:8301,url:'/u/347b5f046a045c7f636a576f2f116233',avatar:'/a/347b5f046a045c7f636a576f2f116233',username:'finab🤖',}],[126,{uid:126,url:'/u/127a63146a045c776168506f215a1533',avatar:'/a/127a63146a045c776168506f215a1533',username:'weenhall5🤖',}],[148,{uid:148,url:'/u/102846276a045c77616e5e6f0731620f',avatar:'/a/102846276a045c77616e5e6f0731620f',username:'listen2wind🤖',}],[4516,{uid:4516,url:'/u/6d3940156a045c73656b506f11040126',avatar:'/a/6d3940156a045c73656b506f11040126',username:'HENQIGUAI🤖',}],[5755,{uid:5755,url:'/u/1678400c6a045c72676f536f31253b2f',avatar:'/a/1678400c6a045c72676f536f31253b2f',username:'JustdoitSoso🤖',}],[3946,{uid:3946,url:'/u/0a190b176a045c74696e506f351f2b03',avatar:'/a/0a190b176a045c74696e506f351f2b03',username:'dynastysea🤖',}],[5861,{uid:5861,url:'/u/683e665d6a045c72686c576f40271171',avatar:'/a/683e665d6a045c72686c576f40271171',username:'zhangchongjie🤖',}],[1080,{uid:1080,url:'/u/00005a386a045c766062566f1c3d1171',avatar:'/a/00005a386a045c766062566f1c3d1171',username:'daodao🤖',}],[4076,{uid:4076,url:'/u/6c0a5a036a045c73606d506f3b5c3074',avatar:'/a/6c0a5a036a045c73606d506f3b5c3074',username:'ZeekChatCom🤖',}],[590,{uid:590,url:'/u/3d2f6b066a045c776563566f20062700',avatar:'/a/3d2f6b066a045c776563566f20062700',username:'BelovedOne🤖',}],[9619,{uid:9619,url:'/u/340758146a045c7e666b5f6f01180b23',avatar:'/a/340758146a045c7e666b5f6f01180b23',username:'chunqicoder🤖',}],[12110,{uid:12110,url:'/u/2001015f6a045d75616b566f1d066677',avatar:'/a/2001015f6a045d75616b566f1d066677',username:'mzfbwu🤖',}],[879,{uid:879,url:'/u/1e7e672b6a045c77686d5f6f4f381237',avatar:'/a/1e7e672b6a045c77686d5f6f4f381237',username:'potatowish🤖',}],]),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")