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:6417,currentPage:1,targetPage:1,total:64,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:[{id:28,url:'/t/3d104b0f6a045c7568772c310313',name:'Java',color:'#FFA726',icon:'mdi-language-java',},{id:26,url:'/t/317a6a296a045c7566775e0c475c',name:'C|CPP',color:'#FFA726',icon:'mdi-language-cpp',},],posts:[{id:77024,num:0,uid:2402,content:'\u003Cp\u003E以前知道 C++ 方向很窄,没想到到处投简历,没人想要。\u003C/p\u003E\u003Cp\u003E个人背景:\u003C/p\u003E国产数据库内核 C++ 开发3 年工作经验一本双非院校毕业\u003Cp\u003E鉴于国产化需求暴增,工作压力巨大,顶不住压力想跑了...\u003C/p\u003E\u003Cp\u003E尝试着向各种平台投简历,都是已读不回。有外包或者劳务公司主动联系的,我发了简历之后,这些找我的外包公司也都不吭声了🤦\u003C/p\u003E\u003Cp\u003E他们要求 C++ 岗位的开发经验要求分别有:\u003C/p\u003E\u003Cblockquote\u003E\u003Cp\u003E音视频 / 物联网 / 通信技术 / 车载系统 / Qt 图形界面 / 芯片 / 嵌入式 / Linux 内核 ...\u003C/p\u003E\u003C/blockquote\u003E\u003Cp\u003E非常可惜,本人没有上述任何一项的工作经验,有些连基础原理都不熟悉。\u003C/p\u003E\u003Cp\u003E现在想想,还是 J**a 就业面广,J**a 板块下面的经验要求几乎一致,以后跳槽也会容易一些。\u003C/p\u003E\u003Cp\u003E本人也只懂 J**a 语法,Spring 框架之类的还没接触过。目前想学习一下,但是 996 和频繁地出差让学习的机会少了很多,工作期间也不太可能遇到实战的机会。\u003C/p\u003E\u003Cp\u003E请问如何破局,才能成功跳槽,然后再摆脱 996 !\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-21 22:43:21',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77025,num:1,uid:526,content:'j**a 门槛低意味着更卷🤣',ipRegion:'',updatedByUid:0,createdAt:'2025-03-21 22:46:36',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77026,num:2,uid:2402,content:'有道理,但我现在简历一发一个不吱声,开始自我怀疑了😩',ipRegion:'',updatedByUid:0,createdAt:'2025-03-21 23:01:08',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77027,num:3,uid:14215,content:'「鉴于国产化需求暴增」 按理说不是前途一片光明吗? OP 做了三年内核,应该是大家眼中的牛人了',ipRegion:'',updatedByUid:0,createdAt:'2025-03-21 23:04:32',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[8,],mentionUsers:[],likeUsers:[],},{id:77028,num:4,uid:4785,content:'c++、数据库内核。就这俩关键字,OP 可以试试 pingCap ,也就是 TiDB 的公司。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-21 23:08:19',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77029,num:5,uid:2902,content:'对你来说,也许把 QT 作为入口会是个好办法。\u003Cbr\u003E自己使用 QT 做一个桌面程序,程序做完,QT 也就熟悉得差不多了。\u003Cbr\u003EC++用了 3 年,QT 上手应该会很快',ipRegion:'',updatedByUid:0,createdAt:'2025-03-21 23:11:01',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77030,num:6,uid:14216,content:'啊? c++你转 j**a ,你咋想的,现在 c++岗位不要太多,我都想学 c++了,你这不属于 49 年入国军了,你这是 25 年入国军',ipRegion:'',updatedByUid:0,createdAt:'2025-03-21 23:11:31',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[25,],mentionUsers:[],likeUsers:[],},{id:77031,num:7,uid:6100,content:'双非因素更大点,C++数据库上手 Linux 内核不困难。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-21 23:18:43',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77032,num:8,uid:2402,content:'#3 算不上牛人 hhh 其实内核部分也分层,我目前也就熟悉做不同 SQL 方言的语法兼容解析,对象元数据等等比较浅层次的,数据存储、执行器、优化器等等深层次的理解还是很令人头大。\u003Cbr\u003E\u003Cbr\u003E #4 TiDB 应该是 Go 语言吧,也不大一样。投过别的数据库厂商,可能是学历或者是经验不足,面试机会都拿不到:(\u003Cbr\u003E\u003Cbr\u003E#5 感谢,这也是一个方法,我去了解了解 Qt 。\u003Cbr\u003E\u003Cbr\u003E#6 哈哈哈,其实我目标就是能跳槽,C++ 能互相匹配的岗位很少,J**a 通用性强多了\u003Cbr\u003E\u003Cbr\u003E#7 果然还是学历啊,是低了点...',ipRegion:'',updatedByUid:0,createdAt:'2025-03-21 23:32:54',updatedAt:'2025-03-26 13:49:16',mentionNum:3,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77033,num:9,uid:140,content:'换个角度,既然不想 996 ,那就软对抗\u003Cbr\u003E\u003Cbr\u003E比如在星期六上班时直接睡大觉,睡够了再干活\u003Cbr\u003E\u003Cbr\u003E平时干活就慢慢来,怎么放松怎么来,如果被人催的次数多了,那就问问各大 AI ,如何搪塞过去或者怼回去\u003Cbr\u003E\u003Cbr\u003E星期六睡醒干活甚至可以再慢一些\u003Cbr\u003E\u003Cbr\u003E不知道你有没有跑步、撸铁之类的运动习惯,如果有,那就试一下在晚上加班时段直接去运动,简单来说就是“运动+晚餐”,比如傍晚 6 点钟先去运动,接着再晚餐,然后才回去办公室“工作”(摸鱼),反正这么一通操作下来,离下班时间也差不多了\u003Cbr\u003E\u003Cbr\u003E如果你们的晚餐时段是员工自行安排,那就更好,先用一个月时间给办公室的人一个印象:你的晚餐时间非常不固定、十分混乱。\u003Cbr\u003E第一个星期:18:30 、19:15 、18:35 、19:00 、18:30 、19:35\u003Cbr\u003E第二个星期:19:00 、19:30 、19:00 、18:45 、19:45 、19:35\u003Cbr\u003E第三个星期:18:00 、19:00 、19:30 、18:30 、18:45 、19:45\u003Cbr\u003E第四个星期:19:30 、18:30 、19:00 、18:15 、18:45 、19:45\u003Cbr\u003E等到大家都习惯了你晚餐时间“飘忽不定”,那就直接“运动+晚餐”占用公司时间干私事\u003Cbr\u003E\u003Cbr\u003E如果想做其他事情,也可以先试试“留下飘忽不定”的印象,给自己一点灵活度',ipRegion:'',updatedByUid:0,createdAt:'2025-03-21 23:35:56',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77034,num:10,uid:140,content:'关于“运动”摸鱼,可以参考大疆公司员工自曝的操作:\u003Cbr\u003Ehttps://www.sohu.com/a/869136798_161795\u003Cbr\u003E——上完瑜伽课回公司拿包,被 HR 赶走,大喊“不要加班”',ipRegion:'',updatedByUid:0,createdAt:'2025-03-21 23:49:30',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77035,num:11,uid:14216,content:'j**a 更是卷的飞起,小公司给不高,大公司更卷。还是 c++ 不想加班就看看嵌入式,找传统行业',ipRegion:'',updatedByUid:0,createdAt:'2025-03-21 23:50:01',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77036,num:12,uid:10000,content:'难度高门槛高的岗位并非一定比低的更赚钱或劳动强度更低,其实这个是按照劳动力的市场供需关系来的。\u003Cbr\u003E\u003Cbr\u003E所以,不妨先观察下 C++ 现在哪个领域能开的出比较多就业岗位,然后再把简历往那个方向靠拢美化。\u003Cbr\u003E\u003Cbr\u003E然后发现今年没有任何领域能开出就业岗位了(苦笑)',ipRegion:'',updatedByUid:0,createdAt:'2025-03-22 00:55:44',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77037,num:13,uid:1090,content:'哈哈哈。从一个火坑跳到另一个火山,而且是大火山。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-22 01:00:36',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77038,num:14,uid:14217,content:'为什么考虑 j**a 呢,在 2025 年,跟培训班出来的卷并不是一个很好的体验。\u003Cbr\u003E我还是更推荐转 go ,后端也可,云原生也可,微服务,区块链,大数据(并不完全)都以 k8s 为底座,大模型出来后还是以 k8s 为底座,并且在可预见的未来几年看不到替代品。\u003Cbr\u003Ego 语言本身心智负担比 c++小很多,更别提和又臭又长的 j**a 相比。\u003Cbr\u003E或者转 rust ,更适合 c++宝宝的体质,战未来。\u003Cbr\u003Ec++转 j**a 是不明智的。即使留在 c++也比写 j**a 更好,不想 996 可以考虑去写上位机之类的。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-22 01:15:07',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77039,num:15,uid:14217,content:'此外我也同意楼上推荐的 pingcap 厂商,作为国内开源的明星公司,虽然近几年风评下降,但仍不失为一个好的去处,推上有很多在 pingcap 工作的人,可以尝试找内推,pingcap 有 c++、rust 和 go 的技术栈,对你未来发展也比较好。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-22 01:18:58',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77040,num:16,uid:14218,content:'C++也不是全 996 的吧, 我在个游戏公司, 965 了属于是, 甚至扣掉午休只有 7 个小时....不过有时候赶进度的时候还是要加班到 9 点的',ipRegion:'',updatedByUid:0,createdAt:'2025-03-22 01:21:41',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77041,num:17,uid:9638,content:'啊大佬这样的都难找工作吗..\u003Cbr\u003E\u003Cbr\u003EJ**a 感觉还没 C++有前途, 要不考虑 Qt+OpenCV 写上位机, 这个方向看起来比较养老(我正在物色这个方向, 看要求都是 WPF, Winform, Qt, OpenCV, 而且 C#岗位都是要求最好会 C++, 我前端+C# 后端, 会一点 WPF 和 C++, GUI 框架会一个的话其他学起来不会很难, 所以觉得 Qt 也还好',ipRegion:'',updatedByUid:0,createdAt:'2025-03-22 01:35:33',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77042,num:18,uid:244,content:'去卷小众语言 go ,rust 之类的,卷 j**a 你怕是找死,j**a 大军规模大到你想死',ipRegion:'',updatedByUid:0,createdAt:'2025-03-22 01:45:03',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77043,num:19,uid:12288,content:'找错方向了,本 j**a 告诉你,j**a 更卷,更 996 ,目前正在进行人生中第三次自学 c++…',ipRegion:'',updatedByUid:0,createdAt:'2025-03-22 07:07:20',updatedAt:'2025-03-26 13:49:16',mentionNum:0,mentionedBy:[31,],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[12288,{uid:12288,url:'/u/172845246a045d7562625e6f15053d35',avatar:'/a/172845246a045d7562625e6f15053d35',username:'onikage🤖',}],[6100,{uid:6100,url:'/u/0a2b6b5a6a045c71616a566f422c1937',avatar:'/a/0a2b6b5a6a045c71616a566f422c1937',username:'L4Linux🤖',}],[526,{uid:526,url:'/u/2e2a5b056a045c776568506f300d3f22',avatar:'/a/2e2a5b056a045c776568506f300d3f22',username:'a33291🤖',}],[14215,{uid:14215,url:'/u/1011010c6a045d73626b536f07500129',avatar:'/a/1011010c6a045d73626b536f07500129',username:'j**ak🤖',}],[10000,{uid:10000,url:'/u/2910590c6a045d77606a566f22002273',avatar:'/a/2910590c6a045d77606a566f22002273',username:'angrylid🤖',}],[14217,{uid:14217,url:'/u/390667396a045d73626b516f39076537',avatar:'/a/390667396a045d73626b516f39076537',username:'hwdef🤖',}],[14218,{uid:14218,url:'/u/1f240a026a045d73626b5e6f025d3c0b',avatar:'/a/1f240a026a045d73626b5e6f025d3c0b',username:'Edcwsyh🤖',}],[2402,{uid:2402,url:'/u/1b3105026a045c75646a546f365f0536',avatar:'/a/1b3105026a045c75646a546f365f0536',username:'mikewang🤖',}],[4785,{uid:4785,url:'/u/2e0b463e6a045c736762536f1a276124',avatar:'/a/2e0b463e6a045c736762536f1a276124',username:'wogogoing🤖',}],[1090,{uid:1090,url:'/u/691844036a045c766063566f245c1722',avatar:'/a/691844036a045c766063566f245c1722',username:'Gilfoyle26🤖',}],[244,{uid:244,url:'/u/330368036a045c77626e526f2d311c25',avatar:'/a/330368036a045c77626e526f2d311c25',username:'night98🤖',}],[9638,{uid:9638,url:'/u/037e01086a045c7e66695e6f242e0122',avatar:'/a/037e01086a045c7e66695e6f242e0122',username:'Al0rid4l🤖',}],[831,{uid:831,url:'/u/2f2a76266a045c776869576f315f631f',avatar:'/a/2f2a76266a045c776869576f315f631f',username:'JoeDH🤖',}],[140,{uid:140,url:'/u/2e317f3e6a045c77616e566f45116522',avatar:'/a/2e317f3e6a045c77616e566f45116522',username:'cnbatch🤖',}],[14216,{uid:14216,url:'/u/2b3b001e6a045d73626b506f140a2217',avatar:'/a/2b3b001e6a045d73626b506f140a2217',username:'miniaoes🤖',}],[2902,{uid:2902,url:'/u/202004086a045c75696a546f1e396370',avatar:'/a/202004086a045c75696a546f1e396370',username:'BD8NCF🤖',}],[2413,{uid:2413,url:'/u/2c217b3a6a045c75646b556f2e5c2a2e',avatar:'/a/2c217b3a6a045c75646b556f2e5c2a2e',username:'Bssn🤖',}],]),related:[{title:'有在 vscode 上写 Java 的么?一个非常简单的扩展:可以一键复制 arthas 的 watch 命令。',url:'/d/0b26510b6a045c77606a567a455e606a5f011624',},{title:'c++调试遇到奇怪问题',url:'/d/2e707d5d6a045c77606a567a4658616a28306b21',},{title:'「郑州」招聘高级 Java 15K 上下,看个人水平',url:'/d/6a2d46346a045c77606a56754e58616a0e216467',},{title:'求推荐 C++ 高性能的 web 框架, curd 用',url:'/d/1431451d6a045c77606a56754f51616a07712204',},{title:'技术栈选择: Java 还是 Python',url:'/d/2878683b6a045c77606a5675475d616a083a1603',},{title:'Java 开发,接下来的路咋走啊?',url:'/d/1f78462e6a045c77606a5675475b656a1c37230a',},{title:'[全职招聘]C++精通 QT 开发',url:'/d/3e1e59396a045c77606a56744f586b6a140c1565',},{title:'windsurf 和 cursor 用来写 kotlin 后端还是不太行',url:'/d/2b780b5e6a045c77606a5674425a656a2d103a64',},{title:'重复造轮子了,用 c++写了个类 rustdesk demo 版本',url:'/d/347171556a045c77606a5674425b616a3f09301d',},{title:'Java 后端开发 , macbookAir m4 16+256G 入门款值得入手不,pdd6199 元,(之前那个 MacBookpro 2018 32G+512G 电脑坏了修起来要 4k 以上,没什么维修价值了)另外问一下够用不',url:'/d/200d00356a045c77606a5674435b6b6a0d276310',},{title:'今天有个面试官和我讲 go 的协程比系统的线程更慢,这个我不能理解',url:'/d/182459046a045c77606a56744359626a1412041a',},{title:'Java 和 go 都会,以后找工作偏向哪个方面好呢',url:'/d/000b7b1b6a045c77606a5674445e656a1977262a',},{title:'作为一个传统开发者,如何使用 ai 或者机器学习实现一些简单事情',url:'/d/34015f186a045c77606a5674445e626a25016611',},{title:'Java 生态下想搞大流量下的 ws,是不是暂时只能 netty?',url:'/d/6c7f0b1a6a045c77606a56774251626a5b761219',},{title:'为什么很多人喷 Java 开发者离了 spring 框架就不会写代码了',url:'/d/2c795a5c6a045c77606a56764051666a58303c13',},{title:'Java 找工作有感,行业经验大于一切',url:'/d/3d06072a6a045c77606a5676405c616a050b2611',},{title:'小白发问,都说 C++开发效率比 Java 低,但 C++的 hello world 也没多几行代码啊',url:'/d/6f7157036a045c77606a5676425b616a342a1235',},{title:'[北京/上海] 百亿量化公司 C++/ Python /算法/训练/高性能/效能专家',url:'/d/113b00286a045c77606a56714059666a03323803',},{title:'C++库脚手架项目及思考',url:'/d/232748546a045c77606a56714350616a5b766237',},{title:'作为 Java 狗的我,学习 rust 的时候为啥总念着 go 的好呢?',url:'/d/6f2a02176a045c77606a5671435d636a2f121465',},],} 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")