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:8595,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:115010,num:0,uid:19064,content:'\u003Cp\u003E山东人不想回老家发展,问了下 DeepSeek ,他给我推荐成都,就来了,打算长久定居。\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 11:38:59',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115011,num:1,uid:4269,content:'成都妹子颜值肉眼可见的高,你小子有福了',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 11:39:52',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115012,num:2,uid:5859,content:'DS 控制人类原始版本哈哈哈',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 11:41:45',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115013,num:3,uid:12376,content:'北嫖 7 年,现在嫖到🇯🇵了...',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 11:43:13',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[28,32,43,],mentionUsers:[],likeUsers:[],},{id:115014,num:4,uid:16792,content:'北漂 10 年,21 年定居成都买房,失业中,现在把交了 8 年的保险退掉了。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 12:23:49',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[85,],mentionUsers:[],likeUsers:[],},{id:115015,num:5,uid:19065,content:'哎 刚跟家里人 说退保险的事情 下一秒就点了这个帖子 看到你的回复了 保险退掉 还能退一部分钱?',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 12:27:50',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115016,num:6,uid:19066,content:'北漂八年,来成都两年了。我是聊城人。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 12:29:40',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[34,],mentionUsers:[],likeUsers:[],},{id:115017,num:7,uid:16792,content:'我跟媳妇俩,总共交了 13w ,现在退掉返还现金价值,5.8w 。这个钱不是主要的,主要的是节流,这个重疾险我俩一年要缴纳 2w ,压力大了。\u003Cbr\u003E当然我家里还有如下消费险:\u003Cbr\u003E1 ,孩子:重疾+医疗+意外+医保;\u003Cbr\u003E2 ,我俩:医疗+意外+医保。重疾险取消了。\u003Cbr\u003E\u003Cbr\u003E相当于取消了一层防火墙,其他的还是要有。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 12:31:50',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[11,],mentionUsers:[],likeUsers:[],},{id:115018,num:8,uid:19065,content:'那我跟你几乎一样 ;我买的人保的重疾险 一年也是小 2w',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 12:33:51',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[9,],mentionUsers:[],likeUsers:[],},{id:115019,num:9,uid:16792,content:'#8 刚跟保险销售电话了 40 分钟,安慰我说会好起来的,这句话也送给老哥。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 12:35:35',updatedAt:'2025-04-19 23:47:45',mentionNum:8,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115020,num:10,uid:11624,content:'家住成都,在北京读书即将毕业,生化环材专业的想找成都的工作实在太难了,海投简历没回应,很多单位甚至没有招聘需求,感觉回不去了 :(',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 12:47:24',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115021,num:11,uid:3903,content:'#7 之前也考虑过,但是会亏不少钱,还是留着吧',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 12:59:56',updatedAt:'2025-04-19 23:47:45',mentionNum:7,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115022,num:12,uid:52,content:'之前也想去成都,就是不好就业',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 13:00:07',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115023,num:13,uid:17356,content:'定居了吗',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 13:07:33',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115024,num:14,uid:16792,content:'股票、房价、失业,亏损的比这个多的多',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 13:07:50',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[73,],mentionUsers:[],likeUsers:[],},{id:115025,num:15,uid:4560,content:'DeepSeek 的回答应该是被成都的文宣污染了,不需要考虑就业、小孩教育、对空气质量没要求的可以来成都。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 13:41:46',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115026,num:16,uid:601,content:'建议先租房体验一段时间再想想',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 13:43:13',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115027,num:17,uid:19067,content:'北漂 5 年,19 年回成都老鸟',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 13:52:30',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115028,num:18,uid:11703,content:'方便说下成都对北方人的魅力吗?没有去过成都,不是很清楚',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 13:55:11',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115029,num:19,uid:4075,content:'主要还是户口没门槛,房子比一线便宜吧',ipRegion:'',updatedByUid:0,createdAt:'2025-04-16 14:00:46',updatedAt:'2025-04-19 23:47:45',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[16792,{uid:16792,url:'/u/0d21715b6a045d716763546f3a1c077f',avatar:'/a/0d21715b6a045d716763546f3a1c077f',username:'nicksors🤖',}],[4269,{uid:4269,url:'/u/202853206a045c73626c5f6f0d1a0571',avatar:'/a/202853206a045c73626c5f6f0d1a0571',username:'hkiJ**a🤖',}],[52,{uid:52,url:'/u/2d0605376a045c77606f546f42301174',avatar:'/a/2d0605376a045c77606f546f42301174',username:'foolishcrab🤖',}],[966,{uid:966,url:'/u/381954096a045c77696c506f2d06640f',avatar:'/a/381954096a045c77696c506f2d06640f',username:'ToneSun🤖',}],[277,{uid:277,url:'/u/293841266a045c77626d516f3f052a32',avatar:'/a/293841266a045c77626d516f3f052a32',username:'frankkly🤖',}],[12376,{uid:12376,url:'/u/3f26043a6a045d75636d506f153b0525',avatar:'/a/3f26043a6a045d75636d506f153b0525',username:'zmxnv123🤖',}],[4075,{uid:4075,url:'/u/0233462b6a045c73606d536f43053c26',avatar:'/a/0233462b6a045c73606d536f43053c26',username:'ScepterZ🤖',}],[11624,{uid:11624,url:'/u/3e1c593d6a045d766668526f103f303d',avatar:'/a/3e1c593d6a045d766668526f103f303d',username:'Les1ie🤖',}],[4560,{uid:4560,url:'/u/302a5a396a045c73656c566f115a207f',avatar:'/a/302a5a396a045c73656c566f115a207f',username:'lvtuyukuai🤖',}],[19069,{uid:19069,url:'/u/6a2a02286a045d7e606c5f6f33221b26',avatar:'/a/6a2a02286a045d7e606c5f6f33221b26',username:'jqk🤖',}],[11703,{uid:11703,url:'/u/2f077f1b6a045d76676a556f465d1106',avatar:'/a/2f077f1b6a045d76676a556f465d1106',username:'wgbx🤖',}],[19067,{uid:19067,url:'/u/371841176a045d7e606c516f4e503725',avatar:'/a/371841176a045d7e606c516f4e503725',username:'l123456789jy🤖',}],[19065,{uid:19065,url:'/u/2f314a286a045d7e606c536f3b036615',avatar:'/a/2f314a286a045d7e606c536f3b036615',username:'PrayT🤖',}],[19066,{uid:19066,url:'/u/347e733f6a045d7e606c506f301a0114',avatar:'/a/347e733f6a045d7e606c506f301a0114',username:'zbm1991🤖',}],[14477,{uid:14477,url:'/u/030f683c6a045d73646d516f1b50302b',avatar:'/a/030f683c6a045d73646d516f1b50302b',username:'miaotaizi🤖',}],[5859,{uid:5859,url:'/u/1505463d6a045c72686f5f6f3d3e250e',avatar:'/a/1505463d6a045c72686f5f6f3d3e250e',username:'prefect🤖',}],[19064,{uid:19064,url:'/u/171a65016a045d7e606c526f44036413',avatar:'/a/171a65016a045d7e606c526f44036413',username:'arongpm🤖',}],[17356,{uid:17356,url:'/u/1620420f6a045d70636f506f34582b32',avatar:'/a/1620420f6a045d70636f506f34582b32',username:'ChainLock🤖',}],[3903,{uid:3903,url:'/u/032c79226a045c74696a556f4011053d',avatar:'/a/032c79226a045c74696a556f4011053d',username:'CY4suncheng🤖',}],[3886,{uid:3886,url:'/u/3930402c6a045c746862506f3c582b28',avatar:'/a/3930402c6a045c746862506f3c582b28',username:'xixibb🤖',}],[601,{uid:601,url:'/u/3d3b5c186a045c77666a576f12396b0b',avatar:'/a/3d3b5c186a045c77666a576f12396b0b',username:'Dorathea🤖',}],]),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")